To take Nobu Games' example one step further you do have a singleton that 
is always running and that is the application class.  You can subclass it 
and use it to store any state variables you want to use across you app. 
 That way if you need to switch activities you can and don't have to do 
everything in one "God" activity.  You can access the application as shown 
below where "YourApplicationClass" is your sub-classed application object. 
 Just make sure when storing in the application object you save things 
immediately to persistent storage if you need the data to outlive the 
session.  Reason being is while the application has a onCreate() event it 
does not have an onDestory().  It does have an onTerminate() but it is 
not guaranteed to execute on every exit. 


((YourApplicationClass)mCTX.getApplicationContext())

I also agree with using broadcast receivers and intents.  If data security 
is important be sure to use LocalBroadcastManager to launch and manager 
receivers so that you don't broadcast the intent to the entire phone. 


Thanks,
George

-- 
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