There is a login activity - and, after logging, the user enters the Activity -b, when the application is minimized and opened, the activity -a reopens, but each time the user enters his data, logging is strained.

How are application launches implemented when the necessary early forms disappear, and do you need to start with activity-b?

    1 answer 1

    You can save the authorization status, in the simplest case, in the form of a flag in SharedPreferences .

    After authorization, save the status:

     SharedPreferences sharedPreferences = getActivity().getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean("IS_AUTHORIZED", true); editor.commit(); 

    After logging out:

     SharedPreferences sharedPreferences = getActivity().getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean("IS_AUTHORIZED", false); editor.commit(); 

    When you start the activation you get the status:

     SharedPreferences sharedPreferences = getActivity().getPreferences(Context.MODE_PRIVATE); boolean isAuthodized = sharedPreferences.getBoolean("IS_AUTHORIZED", false); 

    If isAuthodized == true , then open the necessary activation.

    Also, activation with authorization is advisable to specify the android:noHistory="true" attribute android:noHistory="true" .