android – Do not allow the user to return to the login once entered the system

Question:

Well, I have an Android app in which I have the following so far: The login screen and a "Welcome" screen, the point is that when the user manages to enter with the correct email and password I take him with an Intent to the screen of "Welcome", but by clicking on the "back" button he can return to the login screen, which I do not want to happen.

Answer:

Regularly the Login or Splash screens start a MainActivity depending on authentication or certain features after allowing entry to the application.

Therefore by allowing input to MainActivity you finish your previous screen (login or splash) with finish()

Example:

Intent intent = new Intent(Login.this, MyActivity.class);
startActivity(intent);
//finaliza Login.
finish();
Scroll to Top