Answer the question
In order to leave comments, you need to log in
Why do buttons stop working when I call a dialog box?
Hello.
Before going back, I display a clarifying dialog box, if the user clicks "Yes", then only then do I return to the previous activity.
@Override
public void onBackPressed() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder
.setMessage(R.string.return_back_confirm)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
LoginCodeActivity.super.onBackPressed();
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
}).create().show();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question