showing a progress bar during file upload

后端 未结 5 1358
心在旅途
心在旅途 2021-01-21 03:47

I\'ve got an async task that is supposed to show progress during a file upload. Everything is working except that it looks like it finishes the file upload really really fast,

5条回答
  •  死守一世寂寞
    2021-01-21 04:07

    You can use Progress Dialog class as follows,

    ProgressDialog progDailog = ProgressDialog.show(this,"Uploading", "Uploading File....",true,true);
    
    new Thread ( new Runnable()
    {
         public void run()
         {
          // your loading code goes here
         }
    }).start();
    
    Handler progressHandler = new Handler() 
    {
         public void handleMessage(Message msg1) 
         {
             progDailog.dismiss();
         }
    }
    

提交回复
热议问题