android - How to put the determinate progress bar
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);
精彩评论