Nitesh Meshram
Nitesh Meshram

Reputation: 555

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 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

Answers (2)

Hanry
Hanry

Reputation: 5531

for each activity: you can add in AndroidManifest.xml

<activity android:name="nameofActivity"
android:noHistory="true"></activity> 

Upvotes: 1

Vicente Plata
Vicente Plata

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

Related Questions