How to show a "Loading..." dialog in android? -


how create dialog show loading in android? want show dialog "loading..." while aynctask running. tried activity theme.dialog. please help.

my code:

private class getlisttask extends asynctask<void, void, string> {     @override     protected string doinbackground(void... arg0) {         sourceurl srcgrabber = new sourceurl ();         string result = "";          try {                              url = url + usr + "&qry=" + query;               result = srcgrabber.grabsource(url);                        } catch (exception e) {             log.e("exception", e.tostring());         }          return result;     }      @override     protected void onpostexecute(string result) {         textview txtview1 = (textview) findviewbyid(r.id.textview);         txtview1.settext(result);     } } 

use progressdialog class show it.

/*****************************************  * asynctask class parse , display  ******************************************/ class asynctaskclassname extends asynctask<void,void, void>{     progressdialog progressdialog = null;      /* ***********************************      * pre-execute method       * ********************************** */     @override     protected void onpreexecute() {         progressdialog = util.getprogressdialog(activityclassname.this, "please wait...", "parsing list...    ");            //activityclassname -> name of activity class want show progressdialog         // progressdialog.hide();         progressdialog.show();          /* pre-execute configuration */     }      /* ***********************************      * execute method       * ********************************** */     @override     protected void doinbackground(void... arg0) {         /* yourxec task ( load url) , return value */         return null;     }      /* ***********************************      * post-execute method       * ********************************** */     @override     protected void onpostexecute(void result) {         progressdialog.dismiss();                      /* post -execute tasks */     } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -