I have an AlertDialog dlgDetails
which is shown from another AlertDialog dlgMenu
. I would like to be able to show dlgMenu again if the user presses the back button in dlgDetails and simply exit the dialog if he presses outside the dialog.
I think the best way to do this is to override onBackPressed
for dlgDetails, but I am not sure how to do that since AlertDialogs must be created indirectly using the Builder.
I am trying to create a derived AlertDialog (public class AlertDialogDetails extends AlertDialog { ...}
) but then I guess I must also extend AlertDialog.Builder
in that class to return an AlertDialogDetails, but isn't there a simpler way? And if not, how would you go about overriding the Builder?