這是怎麼了創建PorgressDialog:安卓:無法解僱ProgressDialog
... 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秒我想dimiss對話框,但它不工作:(請幫助。
好吧,我只是測試多一個方法..其這樣:創建你的進步dialoge一樣,progressDialoge P = ProgressDialoge.show(myContextVariable」標題」, 「消息」);其中myContextVariable在onCreate()中像這樣初始化:myContextVariable = this; //這個「這個」非常重要;否則你可能會得到一個錯誤......現在在處理程序中使用.Cancel函數來取消對話...希望它能夠工作... – Farhan 2011-03-25 13:26:46