我還有一個問題,我與我的alertDialog
,當我強迫關閉在模擬器或設備上的我的應用程序,當我去到的應用程序,設備或模擬器上推出我跑進申請再次我的alertDialog
顯示。我不久前在這個鏈接Shared Prefence for alert dialog is making my application non responsive有類似的問題,我認爲我的所有問題,一勞永逸解決。那麼有人可以幫助我解決這個問題。強制關閉應用程序,使我alertDialog顯示
final SharedPreferences settings = getSharedPreferences("pref_name", 0);
("installed", false);
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
alertDialog.setTitle("Title");
alertDialog.setIcon(R.drawable.ic_launcher);
alertDialog.setAdapter(new MyAdapter(), null);
alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("installed", true);
editor.commit();
}
});
alertDialog.show();
請讓我知道如果你需要我可以對這個代碼運行更
這是哪裏的代碼?它絕對可以顯示一個AlertDialog。詳細說明*爲什麼*它不應該顯示。從你的其他問題看來,它會顯示「installed」是否爲「false」。在這一點上它是否應該是「假」,如果是的話,爲什麼不呢? – codeMagic
抓取崩潰的日誌。 Exception stacktrace是找出它的關鍵。 –
@Alécio我的應用程序沒有兌現,我只是想知道我怎麼能阻止我從對話框顯示用戶強制關閉應用程序的設備 –