My app has three main activity.
- Splash Activity
- Login Activity
- Menu Activity
When I start app, splash screen work with four second, then it goes login activity. If user login successfully then app goes menu activity. In my menu, there is logout button. If user clicks it, then app goes login activity.It works fine. But if users don’t want to logout and click back button on devices, I want to exit from app directly. If I couldn’t find solution for this problem, users have to go login screen, then splash screen and finally exit when they want to exit from app with using back button. Which solution should I use?
After the login has been successful you can call
finish()on your Login Activity just after you started your Menu Activity. This effectively removes the Login Activity from the back stack.Edit: As mentioned in the comment below, this also applies to your Splash Activity.