Ending An Activity After A Video Ends
Hi I am new to android development and I'm working on a game. Right now I have a cutsceen right now which is a videoview that is called after hitting the start button of the game.
Solution 1:
First off, I'm not really familiar with game development, but I guess it would work the same way. Anyway, is the video in a VideoView
? If so, you can call setOnCompletionListener to it so you will be notified that the video is done playing.
You can then call finish() on the activity in the callback method.
public void onCompletion(MediaPlayer mp) {
finish(); //This will end the current activity
}
Solution 2:
myVideoView.setOnCompletionListener(newOnCompletionListener() {
@OverridepublicvoidonCompletion(MediaPlayer mp) {
// TODO Auto-generated method stub//write your code after complete video play
}
});
Post a Comment for "Ending An Activity After A Video Ends"