Hello, please tell me how in the activity on the result of the answer to the question "Close Yes / No" to refuse to close the activity?
Code in activity
@Override public void onBackPressed() { super.onBackPressed(); backBeginActivity(); } protected void backBeginActivity() { String title = "Закрыть активность?"; String message = "Закрыть?"; String buttonYES = "Да"; String buttonNO = "Нет"; AlertDialog.Builder ad = new AlertDialog.Builder(MainActivitySelectTaxi.this); ad.setTitle(title); // заголовок ad.setMessage(message); // сообщение ad.setPositiveButton(buttonYES, new OnClickListener() { public void onClick(DialogInterface dialog, int arg1) { finish(); //Закрыли } }); ad.setNegativeButton(buttonNO, new OnClickListener() { public void onClick(DialogInterface dialog, int arg1) { //А как не закрывать??? Что написать или как это делается? } }); ad.setCancelable(true); ad.setOnCancelListener(new OnCancelListener() { public void onCancel(DialogInterface dialog) { } }); ad.show(); }