What I want to do: When the application starts it reads an email address from a database. If the email address is NOT set, it starts another dialog activity for adding the email address.
If the user doesn’t add the email, he cannot close that dialog activity, so clicking on close button doesn’t close the dialog activity.
The problem that I have is that if the user clicks the back button, the dialog activity closes and the main activity starts without email address set. What I want to do is if the user clicks the back button in this case, to close the application.
I have to mention that I’m using the same dialog activity when I want to edit the email address.
Override
onBackPressed, there check whether user has inserted any email address. If not just return without calling super.onBackPressed().