I’m developing a android aplication using login activity how main activity. When the user login the aplication show other activity (intent), but if the user push back button the application show the main activity with the login. ¿How lock login activity after make login in the aplication?
Thank you!
If you want to prevent the user from returning to the login activity, there are two approaches:
finish()after starting the main activity. This will end the login activity so when the user presses the back button, the app simply finishes.onCreate, you can callstartActivityForResult()and launch your login activity. When the login activity finishes, the main activity can either proceed normally if the login was successful, orfinish()(or operate in a restricted mode) if the user failed to log in.