android - How to dismiss alertDialog manually? -


i trying fetch data server.if gets failed in middle due reasons, displaying alert prompting user restart download once again. have done is, in alert dialog's ok button have called download method once again. makes alert dialog freeze , stops form hiding. when download completed alert dialog gets dismissed. can suggest idea here.

in onclick event dismiss dialog first (dialog.cancel(); or dialog.dismiss() )and call the download function again . use code dialog showdialog(0);

  protected dialog oncreatedialog(int id) {     alertdialog.builder builder = new alertdialog.builder(this); //builder create dialog      switch(id)     {     case 0:          if(game_started)         {             builder.settitle("failed");             builder.setmessage("xxxxx");              //the buttons set dialog box             builder.setpositivebutton("yes", new dialoginterface.onclicklistener() {                 @override                 public void onclick(dialoginterface dialog, int which)                 {                     builder.dismiss();                                      download_again();                 }});           }         break; default:     }     return builder.create();     } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -