views:

39

answers:

0

Hi,

I am writing an Android app in which I've extended the Application class in order to hold some global variables. I initialize these global vars in my root Activity (the first screen that the user sees).

My application contains a number of Activities containing ListViews full of selectable items. When the user selects an item, a new Activity is pushed onto the display stack.

Now if a user is in the 3rd or 4th Activity, and then they press the Home button, my app hides. If the user then force closes my app (using a Task Killer), and then reopens my app, the Application context is initialized and the app starts off in the Activity that the user was on when they clicked the Home button. But the problem is, none of my global variables have been initialized at this point since all that happens only on my first Activity.

So is there any way to force my root Activity to always appear when my app comes to the foreground, if the Application object has not yet been initialized?

Thanks!