page.When在正確的用戶登錄,我想表明一個警告對話框說你的登錄信息已經verified.Click繼續proceed.Now我想這個,我有一個登錄後顯示的警告對話框警報對話框在登錄後顯示在下一個活動頁面上。 這裏是警告對話框代碼 - :只有特定活動頁面
SharedPreferences設置= getSharedPreferences(PREFS_NAME,0); 布爾型dialogShown = settings.getBoolean(「dialogShown」,false);
if (!dialogShown) {
AlertDialog.Builder builder = new Builder(Myperwallet.this);
builder.setTitle("Fast Cashier!");
builder.setMessage("Logging In");
builder.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
//continue activity here....
}
});
builder.create().show();
// AlertDialog code here
}
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("dialogShown", true);
editor.commit();
我嘗試這樣做,但是當我按我已經登錄out.I需要知道如何設置該標誌爲真後,現在警報對話框不會顯示註銷button.Here是我的註銷按鈕的功能 - :
logout.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
AlertDialog alertDialog = new AlertDialog.Builder(Myperwallet.this).create();
alertDialog.setTitle("FastCashier:");
alertDialog.setMessage("Are you sure you want to exit?");
alertDialog.setButton(Dialog.BUTTON_POSITIVE, "Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent logout = new Intent(Myperwallet.this,Login.class);
startActivity(logout);
}
});
alertDialog.setButton(Dialog.BUTTON_NEGATIVE, "NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
alertDialog.show();
}
});
您需要爲在第二活動重新編寫代碼 – Pragnani 2013-04-09 07:14:40