0
대화 상자가 닫히고 "예"가 선택되면 앱이 닫히지 않지만 제대로 보이게됩니다. 실제 앱이 아닌 화면을 닫을 수있는 것 같습니다. 이것은 MainActivity.java에서 가져온 것입니다. 어떤 아이디어 나 권장 사항?대화 상자가 닫힐 때 YES에 도달하면 내 앱이 닫히지 않습니다.
private void showAlerExit() {
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
this);
alertDialogBuilder
.setMessage("Are you sure you want to quit?")
.setCancelable(false)
// button yes
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
// if this button is clicked, close
// current activity
MainActivity.this.finish();
}
})
// button no
.setNegativeButton("No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
}
'화면이 닫힐 수도 있지만 실제 앱이 아닌 것 같습니다.이게 무슨 의미입니까? 노트. 웹 페이지를 닫는 것 이상으로 Android 앱을 "닫지"마십시오. 사용자가 멀리 탐색합니다. – Simon