Use Intents to send the user to whichever Activity you want, and put if or
switch statements in onBackPressed() to fire Intents to take them to
another activity when the back button is pressed:

On Mon, Nov 28, 2011 at 9:04 PM, JP <[email protected]> wrote:

> Hi Guys,
>
> I am creating an app, where I am faced with the following dilemma:
>
> The app I am working on has a "public" and "private" view. To see the
> private view the user needs to log in. The way the workflow works is,
> that when the user opens the app, he first sees a SplashActivity, and
> then he sees the public view on the MainActivity, and then he presses
> a login button, to take him to the LoginActivity.
>
> On the LoginActivity the user can check a box allowing the app to save
> username and password to do an autologin the next time he starts the
> app. The autologin is handled by the SplashActivity.
>
> This works fine... but in certain cases the autologin fails. If the
> network connection times out or something else. In those cases, I
> don't want the user to just be sent to the MainActivity. I want to
> send him to the LoginActivity. But I also want to maintain an activity
> stack, where the user can press the back button and return from the
> LoginActivity to the MainActivity.
>
> Right now I handle that by sending a boolean in the Extra information
> of the Intent. If this boolean is true, I send the user to the
> LoginActivity right away after loading the MainActivity.
>
> That also works, and I maintain the Activity Stack. ... there is just
> one problem.
>
> I see the MainActivity screen flash on the screen before the user is
> sent to the LoginActivity.
>
> Am I going about this wrong, or is there some way I can prevent the
> MainActivity from flashing on the screen?
>
> Thanks,
> JP
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
Raghav Sood
http://www.androidactivist.org/ - Author
http://www.appaholics.in/ - Founder

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

Reply via email to