0
我想檢查一個條件,然後如果它是假的,我想關閉先前顯示的AlertDialog。 不過,我面臨着這樣的錯誤:錯誤與alertdialog.dismiss()
的方法解僱()是未定義的類型AlertDialog.Builder
代碼:
ad.show();
if (call.isInCall()== false)
{
ad.dismiss();
}
問題是什麼?
編輯:問題:
AlertDialog.Builder ad = new AlertDialog.Builder(context);
d = ad.create();
ad.setTitle("Appel en cours...");
ad.setMessage("Voulez vous répondre à cet appel?");
//ad.create();
ad.setPositiveButton("Oui",
.....
if(call.isInCall() == false && d != null && d.isShowing()){
d.dismiss();
}
=>強制關閉。 非常感謝您的幫助。
我會加AlertDialog d = ad.create();在顯示AlertDialog(ad.show())之後?我添加了它,錯誤仍然存在。 – androniennn 2011-04-27 14:21:41
@androniennn不,你不應該從AlertDialog.Builder中調用show()。我會添加一個編輯... – Maximus 2011-04-27 14:25:55
請看我做了什麼(第一篇文章),我有一個力量關閉。感謝你們對我的幫助。 – androniennn 2011-04-27 14:37:22