Reputation: 555
I am very new developer for Android application so please ignore if there is some technical mistakes in my question.
I have five screen (Home, SR-1, SR-2,SR-3,SR-4 ) in my Android application and I can switch any screen at give time.
When we are pressing device back button it will take we to the previous screen where I was lastly.
But whenever I am pressing Home it will take me to landing screen If in this state I am pressing device back button I will take me to previous view but I want to remove this state maintenance.
(i.e. : When I am coming to Home and I pressed back button It will exit from my application)
Thank you
Upvotes: 0
Views: 213
Reputation: 5531
for each activity: you can add in AndroidManifest.xml
<activity android:name="nameofActivity"
android:noHistory="true"></activity>
Upvotes: 1
Reputation: 3380
From android pressing back button should exit the app :
Immediately after you start a new activity, using startActivity
, make sure you call finish()
so that the current activity is not stacked behind the new one.
Upvotes: 1