Do not allow the user to return to the login once logged into the system

5

Well, I have an Android app where I have the following until now: 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 it with an Intent to the "Welcome" screen, but by clicking on the "back" button You can go back to the login screen, which I do not want to happen.

    
asked by Cristian Alvarez Hernandez 29.10.2016 в 17:53
source

2 answers

2

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

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

Example:

Intent intent = new Intent(Login.this, MyActivity.class);
startActivity(intent);
//finaliza Login.
finish();
    
answered by 29.10.2016 / 18:12
source
1

You can add the AndroidManifest.xml attribute in your android:noHistory="true" file to the Activity that you do not want to be able to return to.

For example:

<activity android:name=".Login" android:noHistory="true"/>
    
answered by 29.10.2016 в 18:09