android - played video again automatically after finished -


i doing android application related video player.i played video want when video complete,it resumption automatically in application how can do? using videoview in appliation.

    // displays video file.     videoview mvideoview = (videoview) findviewbyid(r.id.videoview);      string uripath = "android.resource://com.example.anket4dammy/"             + r.raw.dunyagoz;     uri uri = uri.parse(uripath);     mvideoview.setvideouri(uri);     mvideoview.requestfocus();      mvideoview.start();  }  @override public boolean ontouchevent(motionevent event) {     int eventaction = event.getaction();      switch (eventaction) {     case motionevent.action_down:          // timer.cancel();         intent intent = new intent(getapplicationcontext(),                 mainactivity.class);         intent.putextra("exit", false);         intent.setflags(intent.flag_activity_clear_top);         startactivity(intent);          break;       }      return true; }   @override public void surfacechanged(surfaceholder holder, int format, int width,         int height) {     // todo auto-generated method stub  }  @override public void surfacecreated(surfaceholder holder) {     // todo auto-generated method stub  }  @override public void surfacedestroyed(surfaceholder holder) {     // todo auto-generated method stub  } 

try below code

    // video finish listener     mvideoview             .setoncompletionlistener(new mediaplayer.oncompletionlistener() {                  @override                 public void oncompletion(mediaplayer mp) {                     // not playvideo                     // playvideo();                      mp.start();                 }             }); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -