我在SherlockFragment中的操作欄上使用菜單,onClick打開警告對話框,這工作正常,但如果我回去,而對話框不顯示,應用程序崩潰並登錄貓說窗滲漏,我試圖解僱的onPause和調用OnStop對話框但沒有工作我android:sherlock活動時警告對話框的窗口泄漏
AlertDialog.Builder builder = new AlertDialog.Builder(
getSherlockActivity());
builder.setTitle(messageTitle)
.setMessage(message)
.setCancelable(false)
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// TODO Auto-generated method stub
}
});
AlertDialog alert = builder.create();
alert.show();
添加您的日誌也 – VicJordan
更改下面的代碼alertDialog = builder.show(); 然後在onDestory()方法中調用alertDialog.dismiss(); –
發佈完整代碼 –