I have an activit where the user logs in. After the user is logged in, another (main) activation is opened for him. How to make it so that when you press "Back" from the main activation, nothing happens?
4 answers
You can override the onBackPressed method, but this will be at least strange in the sense that the user presses back to wait for a transition to the previous window or close the application.
- In my opinion, it is logical that the logged in user can not open the "Login" page. Is not it so? :( Thank you. - angry
As an option - to keep our own queue and when starting each Activity check that we actually start and switch where necessary. In general, here is https://stackoverflow.com/questions/5001882/how-to-clear-specific-activity-from-the-stack-history/5002392#5002392
after login and initiation of the main activit, to activate where the user logs in, call the finish () method. If you work with fragments, then when you click on HardBack in the main fragment, you need to call the popBackStack method
You can also specify the noHistory parameter in the manifest to enable authorization:
<activity android:name=".LoginActivity" android:noHistory="true" />