Reputation: 6405
How can I use the Android back button to move back within my app instead of closing my app? this is my activity stack Activity A (Main Activity) OK button press -->Activity B OK button Press -->Activity C
When i tab the device Back button it moves to Activity B then again i press the back button app get close (move to android home screen)
I need to go to Main Activity when user back press on Activity B?
NOTE: Im not calling any finish() when moving to next activity..
Sam
Upvotes: 1
Views: 5368
Reputation: 388
Check your AndroidManifest.xml and see if your activity node contains this line:
android:noHistory="true"
If the parent activity has the line above, any new activity opened won't be kept in the activity stack.
Upvotes: 0
Reputation: 4658
Are you really really sure that you are not calling finish? Try a search on finish for the entire app.
Upvotes: 4
Reputation: 10594
Check this How can I use the Android back button to move back within my app instead of closing my app?
Actually, it should not happen unless you are calling finish() because android works with activity stack and as you keep pressing device back button, it calls previous activity on stack.
Upvotes: 0