- Add
 
- Declare progress dialog globally in this page
 
- Add some code in the onCreate method before task start
 
        progressDialog = new ProgressDialog(ClassName.this);
        progressDialog.setMessage("Loading...");
        progressDialog.setCancelable(false);
        progressDialog.setCanceledOnTouchOutside(false);
        progressDialog.setIndeterminate(false);
        progressDialog.show(); 
- Now you can add you Thread. Write your necessary code inside Thread.After finsih you tast and before leaving Thread,please dismiss your progressDialog.
 
             new Thread(new Runnable() {
                                   public void run() {
                                              /* Wirte your Codes which take long time and are not in the main
thread i.e. HttpClient call
thread i.e. HttpClient call
                                                */
                                              progressDialog.dismiss();
                      }
                }).start();
No comments:
Post a Comment