android - How to go back after playing video -



android - How to go back after playing video -

i have application makes list of videos play button. when click on play button, separate activity started using intent. want when video playback finished, activity should automatically finish , go main activity. here code creating videoview.

public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.videoview); intent = getintent(); bundle extras = i.getextras(); filename = extras.getstring("videofilename"); mvideoview = (videoview)findviewbyid(r.id.videoview); path=filename; if (path == "") { toast.maketext( viewvideo.this, "no video selected, toast.length_long).show(); } else { mvideoview.setvideopath(path); mc = new mediacontroller(this); mvideoview.setmediacontroller(mc); mvideoview.requestfocus(); mvideoview.start(); } }

any suggestions???

you can set mediaplayer.oncompletionlistener on videoview using videoview.setoncompletionlistener, you'll able finish containing activity when video finishes playing.

android video playback

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -