2

The first activity in my app is a splash screen with a Progress Dialog in which I load data from a Web Service.
When this is done I start the next activity and call finish() in the first activity's onPause(), in order for it to not appear again.
The next activity is my main menu and on from there I browse the application.
The problem is when I want to leave the application. I return to the main menu from whichever activity I have been to and press BACK or HOME.
If shortly after I launch the app again, my main menu immediately appears and I do not go through the splash screen where the data is brought over. Also, it seems that the data held prior to leaving was released. As a result, the activities I launch from the main menu (which depend on the data fetched during the splash screen) turn up empty.

Does anyone have an idea how to go about this?
Thanks, Rob

2 Answers 2

1

Do you store your data in the bundle that get's loaded by onCreate() when leaving your main activity?

I would recommend to read the section about Saving activity state on http://developer.android.com/guide/topics/fundamentals.html

2
  • No, I don't. I have a data structure which gets populated during the splash screen (first activity). Whenever I need to display some data in a UI component, I turn to the said data structure.
    – Rob
    Jul 19, 2010 at 13:04
  • Thanks Christian. I found the solution in the "Clearing the stack" section of the link you provided.
    – Rob
    Jul 21, 2010 at 15:26
1

As far as i know, The Android Mobile has the Home and key Button to achieve the MultiTasking/Run the App in Background. When you Click Back, It finish the current Activity as Default. When you Click Home, It directly navigate to the Home screen and your App will run at background.

So your scenario is not possible yet and also its not a effective multitasking Environment. So you want to close your app. you have to navigate to the activities with BACK button upto home Screen. If you press HOME, Its Starts the Activity when you leaved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.