App users often press the exit button unintentionally and the need to confirm a user’s exit is eminent. How about a toast that asks the user if the exit is intentional or not? We will be work through a sample code that does just that!
The aim of this article is to give you a heads up whenever you intend implementing an exit dialog in your android project.
Note: This article assumes that you are familiar with Android studio, Kotlin (Anko) and have an ongoing Android project. We will dive into the Kotlin code right away….
The Kotlin code is given below:
You can always copy and edit the code to fit your project need.
I am on a journey to explore the amazing world of Kotlin. You can catch me up on Twitter