Skip to content Skip to sidebar Skip to footer

Closing My Android App In My Main Activity On Back Pressed

I have two activities: A: a Splash Screen B: the Main activity When the application starts, I show the splash screen with a short video then call B. I want the user to be able to

Solution 1:

You can set android:noHistory="true" for the splash screen in the manifest. This will not add the activity to the back stack.

<activityandroid:name="SplashScreen"android:noHistory="true"
    <intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity>

Solution 2:

In your splash screen call finish() when you start Activity B.

Post a Comment for "Closing My Android App In My Main Activity On Back Pressed"