On Fri, Dec 23, 2011 at 6:31 PM, John Goche <johngoch...@googlemail.com> wrote:
> I am having the following issue. In my application I need to display
> activity A the first time the application is launched so that the user
> can configure some parameters on a form. When the user completes
> the form a preference is set so that every other time the user starts
> the application the application starts directly with activity B.
>
> Now I am having some trouble coding this behavior because the
> android manifest file does not seem to allow for this conditional
> launching. It is always the same activity which seems must be
> launched first.
>
> How can I solve this issue?

In onCreate() of Activity A, before you call setContentView(), make
the determination of whether A really needs to be shown. If not, call
startActivity() for B, followed by finish() to get rid of your
unnecessary A.

Or, create Activity C that is your actual launcher entry point, with
android:theme="@android:style/Theme.NoDisplay" in its <activity>
element. It makes the choice of whether to call startActivity() on A
or B to route the user to the right spot, and then calls finish().

Or, have the launcher be Activity B. B, in onCreate(), before you call
setContentView(), see if you need the user to see A instead. If so,
call startActivity() on A, or possibly even startActivityForResult().

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 4.0 Programming Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to