Display Alert dialog box in just of progress dialog completed android -


hello friends want display alert dialog box in of complete progress dialog box. progress complete upto 100 want ask/inform information through alert dialog box.i in both dont know how integrate both please me .. in advance. code following

                   lv.setonitemclicklistener(new onitemclicklistener() {          @override         public void onitemclick(adapterview<?> parent, view view,                 int position, long id) {             no = 1;             int = lv.getselecteditemposition();             toast.maketext(getapplicationcontext(),                     "item " + + " selected",   toast.length_short).show();              system.out.println("progress start");             progressdoalog.setmax(100);             progressdoalog.setmessage("connecting please wait....");             progressdoalog                     .setprogressstyle(progressdialog.style_horizontal);             progressdoalog.show();             progressdoalog.setprogress(0);             new thread(new runnable() {                 @override                 public void run() {                     try {                          // here should write time consuming task...                         while (progressdoalog.getprogress() <= progressdoalog                                 .getmax()) {                              thread.sleep(100);                              handle.post(new runnable() {                                  public void run() {                                     progressdoalog.incrementprogressby(no);                                 }                              });                              system.out.println("before if");                             if (progressdoalog.getprogress() == progressdoalog                                     .getmax()) {                                  system.out.println("u r in if 100");                                 progressdoalog.dismiss();                                 system.out.println("dismiss");                                 //                                 alertdialog.builder alertdialogbuilder = new alertdialog.builder(                                         context);                                      alertdialogbuilder                                          .setmessage("password network")                                         .setmessage(randommessage)                                         .settitle("password")                                         .setcancelable(false)                                         .setpositivebutton("copy",new dialoginterface.onclicklistener() {                                             public void onclick(dialoginterface dialog,int id) {                                               }                                           })                                         .setnegativebutton("cancel",new dialoginterface.onclicklistener() {                                             public void onclick(dialoginterface dialog,int id) {                                                  dialog.cancel();                                             }                                         });                                     alertdialog alertdialog = alertdialogbuilder.create();                                     alertdialog.show();                                 //                                 system.out.println("alert over");                              }                         }                     } catch (exception e) {                     }                 }             }).start();           }      }); 

you can use asynctask this

    public class myasynctask extends asynctask<void, integer, boolean>     {          @override         protected void onpreexecute() {             // todo auto-generated method stub             super.onpreexecute();     /** initialization here setting porgress bar or other   variable it's you*/         }           @override         protected boolean doinbackground(void... params) {             //do work here                          //update progress bar                        publishprogress(total_progress);             return flag;  //return true or false          }          @override         protected void onprogressupdate(integer... values) {              super.onprogressupdate(values);                      //set progress here                      progressbar.setprogress(values[0])         }          @override         protected void onpostexecute(boolean result) {                   //deal alertdialog here             if(result)                      {                       //do our alert dialog                      }                      else                      {                       //do alert dialoge                      }             super.onpostexecute(result);         }         } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -