Exit Dialog for Android Application

 

This is an example of implementing simple Exit Dialog with two options, YES, and NO. The code is simple and straight forward. All you need to do is to override onBackPressed() in your activity and add a simple AlertDialog (you can find tutorial about simple dialog here). We use Builder for doing it:

 

Or using lambda expressions:

When back is pressed we will have an Alert dialog looking like this:

Spread the love

Leave a Reply

Your email address will not be published.