I want to show a \"Thanks for using\" message when the application close.
What is the event that handles application closing?
Assuming you want the dialog to display only when the app is completely closed(removed from background as well), You could just override onDestroy() method in your first activity.
onDestroy()