android - How to disable the resume button in Media player if User clicked it ONce -


i had used function in media player producing alert dialog , respond when user resumed video

  setpositivebutton-->"start over"   setnegitivebutton-->"resume"             public abstract void onclick (dialoginterface dialog, int which){           //what need disable "resume" if user clicked once... 

i pasting whole function here please modify ...

   private void showresumedialog(context context, final int bookmark) {     alertdialog.builder builder = new alertdialog.builder(context);     builder.settitle(r.string.resume_playing_title);     builder.setmessage(string.format(             context.getstring(r.string.resume_playing_message),             galleryutils.formatduration(context, bookmark / 1000)));     builder.setoncancellistener(new oncancellistener() {         @override         public void oncancel(dialoginterface dialog) {             oncompletion();         }     });     builder.setpositivebutton(             r.string.resume_playing_resume, new onclicklistener() {         @override         public void onclick(dialoginterface dialog, int which) {             mvideoview.seekto(bookmark);             startvideo();         }     });     builder.setnegativebutton(             r.string.resume_playing_restart, new onclicklistener() {         @override         public void onclick(dialoginterface dialog, int which) {             startvideo();         }     });     builder.show(); } 

check here code

int flag=0; private void showresumedialog(context context, final int bookmark) {          alertdialog.builder builder = new alertdialog.builder(context);         builder.settitle(r.string.resume_playing_title);         builder.setmessage(string.format(             context.getstring(r.string.resume_playing_message),             galleryutils.formatduration(context, bookmark / 1000)));     builder.setoncancellistener(new oncancellistener() {         @override         public void oncancel(dialoginterface dialog) {             oncompletion();         }     });     builder.setpositivebutton(             r.string.resume_playing_resume, new onclicklistener() {         @override         public void onclick(dialoginterface dialog, int which) {              flag++;             if(flag>1)             {                 mvideoview.seekto(bookmark);                 startvideo();             }else{                  //do nothing             }         }     });     builder.setnegativebutton(             r.string.resume_playing_restart, new onclicklistener() {         @override         public void onclick(dialoginterface dialog, int which) {             startvideo();         }     });     builder.show(); } 

good luck...


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -