我試圖讓我的應用僅在我開始activities
時播放介紹片段。 但是,從我的代碼中,它總是在喚醒之前播放剪輯,然後再恢復到應用程序,儘管我沒有關閉該應用程序。我能做些什麼來解決這個問題?Android始終播放介紹片段
從主:
startActivity(new Intent(this, MyIntro.class));
從MyIntro:
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();
}
}