I'm trying to play an Intro video to my android application.
So whenever my app starts, a movie is played until it ends or until the user touches the screen.
After that the user is forwarded to the menu activity.
So far I have the following:
public class IntroActivity extends Activity {
private VideoView video;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intro);
video = (VideoView) findViewById(R.id.videoView1);
Uri videoUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.seaofbuttons);
video.setVideoURI(videoUri);
video.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (video.isPlaying()) {
video.stopPlayback();
}
Intent menu = new Intent(IntroActivity.this,MenuActivity.class);
startActivity(menu);
finish();
return false;
}
}
I don't know how to catch when the movie playing ended, to be able to forward the user to menu activity.
1)Uri.parse("android.resource://" + getPackageName() + "/" + "resource folder" + "videoname.format"); i think this should work and for 2nd use setOnCompletionListener(MediaPlayer.OnCompletionListener l) http://developer.android.com/reference/android/media/MediaPlayer.OnCompletionListener.html