这就是我创建 PorgressDialog 的方式:
... progressBarDialog = new ProgressDialog( context );
progressBarDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressBarDialog.show(this, "Please Wait", "Updating your GPS coordinates",false,true);
//Trigger GPS service to update coordinates
fg.myOnresume(Name);
fg.dontSendSMS();
//Sets the timer at 30 secs
timer= new Timer();
timer.schedule(new startMapActivity());
}
class startMapActivity extends TimerTask
{
@Override
public void run()
{
//handler.sendEmptyMessage(0);
Log.d("", "StartMapActivty--->>>run()");
// Dismissing Dialog Box
if(progressBarDialog.isShowing())
{
progressBarDialog.dismiss();
}
}
}
所以基本上在计时器 30 秒后完成后,我想关闭对话框,但它不起作用:(请帮忙。
最佳答案
您无法从非 UI 线程修改 UI。使用handlers去做这件事。
关于Android:无法关闭 ProgressDialog,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5432077/