【发布时间】:2009-10-14 19:29:34
【问题描述】:
我正在尝试让我的应用程序仅在我启动 activities 时播放介绍剪辑。
但是从我的代码来看,它总是在唤醒后播放剪辑,然后再恢复到应用程序,尽管我没有关闭应用程序。我能做些什么来解决这个问题?
从主要:
startActivity(new Intent(this, MyIntro.class));
来自我的介绍:
public class MyIntro extends Activity implements OnCompletionListener {
int a;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.intro);
playIntro();
}
public void onConfigurationChanged(Configuration newConfig) {
setContentView(R.layout.intro);
}
public void onCompletion(MediaPlayer arg0) {
// TODO Auto-generated method stub
this.finish();
}
private void playIntro(){
setContentView(R.layout.intro);
VideoView video = (VideoView) this.findViewById(R.id.VideoView01);
Uri uri = Uri.parse("android.resource://real.app/" + R.raw.intro);
video.setVideoURI(uri);
video.requestFocus();
video.setOnCompletionListener(this);
video.start();
}
}
【问题讨论】: