我有實現與多個屏幕的應用程序,從屏幕的任何退出使用android:noHistory="true"
...我有EXITButton
在我的應用程序中的所有屏幕..後退按鈕:noHistory =「真」
但在處理應用程序,如果用戶點擊BACKButton
應用程序結束我都面臨着一個問題,在表...
現在我正在尋找一個AlertDialog
,而用戶點擊默認返回Button
..
向我建議任何解決方案的問題。
一些建議後,我想這一點,這也並非任職..
的,我試圖代碼..
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
super.onBackPressed();
AlertDialog.Builder builder = new AlertDialog.Builder(Login.this);
builder.setMessage("Are you Sure want to close the Application..?")
.setCancelable(false)
.setTitle("EXIT")
.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) {
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
忽略super.onBackPressed(); – SKT