Remove state maintenance of screens Android?
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 maintenanc开发者_JAVA百科e.
(i.e. : When I am coming to Home and I pressed back button It will exit from my application)
Thank you
for each activity: you can add in AndroidManifest.xml
<activity android:name="nameofActivity"
android:noHistory="true"></activity>
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.
精彩评论