Search code examples
androidandroid-activityandroid-manifest

How to hide LoginActivity when app is starting?


I have a LoginActivity that leads to MainActivity once the authentification has been made. In this LoginA, I also have a "RememberMe" checkbox. If the user checks it, he doesn't have to fulfill the authentification form and doesn't even have to click on the Log In button anymore.

Is there a way if the checkbox is checked to not display the LoginA but to start my app with the MainActivity?

In my manifest, I have this:

<activity
     android:name=".activity.LoginActivity"
     android:screenOrientation="portrait"
     android:exported="true">
     <intent-filter>
          <action android:name="android.intent.action.MAIN" />
          <category android:name="android.intent.category.LAUNCHER" />
     </intent-filter>
</activity>

Solution

  • You have to create a new activity known as splash screen which will navigate to login screen or your main activity. You can save a boolean value in shared preference for authentication instsance. If authentication is true then navigate to main activity else go to login activity. The splash screen should be your launcher activity.