开发者

android - How to put the determinate progress bar

开发者 https://www.devze.com 2023-03-18 18:16 出处:网络
In my application I want to display the progress bar 1000msec. I am using the following code but the progress bar is converted to indeterminate mode. How to handle it?

In my application I want to display the progress bar 1000msec. I am using the following code but the progress bar is converted to indeterminate mode. How to handle it?

My Code is as follows,

Exitexpand_pd = ProgressDialog.show(RB_UpcomingExits.this, "", "Please wait...", true);
Thread t = new Thread() 
{
   public void run() 
   {
     try 
     {                                                                                                                                             
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
     Thread.sleep(1000);                                                  
      if(Exitexpand_pd.isIndeterminate())                                                   
         Exitexpand_pd.dismiss();                                                                                        开发者_开发知识库                                   
     } 
    catch (Exception e)
    {                                                    
      e.printStackTrace();
     }                                                              
    rb_Exitexpand_Handler.post(null);                                             
    Exitexpand_pd.dismiss();
  }
};      


See the doc for the show method. You have to change the boolean to false.

Exitexpand_pd = ProgressDialog.show(RB_UpcomingExits.this, "", "Please wait...", false);


Explicitly set that you don't want indeterminate progress in your dialog:

pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pd.setIndeterminate(false);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号