I want to kill my app from a exit button on my navigation drawer. the drawer has a exit button that is suppose to just kill the whole app (all activity) and gets the user out of the app .
When i am using finish()
in the first activity its working but when i go into the app and call finish()
the activity gets killed and returns to previous activity but never really kills the app.
Tried to use System.exit(0)
but no luck.
Extra Information Might Help
I have all my activity started with android:launchMode="singleTop"
. it means all those activities that are already created will not be created again and just reordered to front on calling.
Do anyone have any suggestion for this , please do help.
Update
I want to make some updates here as my question looks like this SO Question.
As i have already said i am using a android:launchMode="singleTop"
. and this answer is not working for my case. I have to call onCreate() to make this happen but it is not my case.