0

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 close application with the back button in activity B. (The user shouldn't see splash screen again.)

Sam
  • 86,580
  • 20
  • 181
  • 179
user999822
  • 445
  • 1
  • 9
  • 17

2 Answers2

4

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

<activity
    android:name="SplashScreen"
    android:noHistory="true"
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
Jereld
  • 162
  • 7
2

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

Sam
  • 86,580
  • 20
  • 181
  • 179
Tarun
  • 13,727
  • 8
  • 42
  • 57
  • is there any way? sometimes I have call home activity when on back pressed. see http://stackoverflow.com/questions/10790222/android-history-stack-clear-without-one – user999822 Jun 02 '12 at 20:10
  • just call finish() in your splashscreen activity, right after you launched your B activity. The splashscreen activity will be terminated. – Rémi F Jun 13 '12 at 14:05