In Android, when the back button clicked, app will navigate to previous page that should be closed.

Take tutorial "Build a Mobile App in 5 min" as an example,

I go through:
1. Login Page (sign in) >
2. Home Screen (click an item) >
3. Todo Page (save data) >
4. back to Home Screen >
5. click Android back button >
6. previous Todo Page (3.) >
7. click Android back button >
8. Home Screen >
9. click Android back button >
10. Login page (without clicking logout button).

While, 6. should exit the app instead of going to previous Todo page or login page.

So how to prevent this?  thanks


Hi Simon,

this is a duplicate of another another post that has a solution. Can you please mark this one as answered?