tags:

views:

67

answers:

1

When I was originally learning about Android a few months ago I swear I read something about a way to immediately launch an activity when starting a task. I am curious about this now because I need to display an intro screen on launch but I don't want the intro screen to be the root activity. Does anyone know if there is something like this and if not what is the best way to handle an intro screen?

I tried googling for a few hours to find it but can't for the life of me.

Thanks for the help.

+3  A: 

Here are a couple of options, using IntroScreen and RootActivity as placeholders for your two Activity classes:

  1. Have the IntroScreen be the one in the manifest that has the LAUNCHER <intent-filter>, so it is what the user opens up. When it is time to switch to the RootActivity, IntroScreen uses startActivity() to start RootActivity and then calls finish() to remove itself from the stack.

  2. Have the RootActivity be the one in the manifest that has the LAUNCHER <intent-filter>, so it is what the user opens up. In onCreate() of the RootActivity, call startActivity() for the IntroScreen. When the user BACK buttons out of the IntroScreen, the RootActivity will appear.

Personally, I prefer option #1.

CommonsWare
#1 works pretty well, thanks. Depends on what you want the BACK button to do I guess.
sehugg
Just a note on #1: Whatever label you give the initial activity will be what is used on the Applications menu. So you'd want to make these activity labels the same as your main activity.
sehugg