How do I save data that I need in more than one Activities? I'm not talking about saving it for different app-runs (I'd like to know this either), but for the time the app is running.
Asked
Active
Viewed 226 times
0
-
1see [this question](http://stackoverflow.com/questions/4878159/android-whats-the-best-way-to-share-data-between-activities) and [this as well](http://stackoverflow.com/questions/1944656/android-global-variable) – Nick Mar 13 '14 at 20:44
-
thanks :-) this helped – Philip Mar 13 '14 at 20:47
1 Answers
1
ContentProviders are a great way of sharing data between two or more apps
check here for the api
The other thing you asked (to share data between activities) is probably best achieved by using intents. Something like this:
Intent intent = new Intent(this.getApplicationContext(), DisplayMessageActivity.class);
intent.putExtra("CONSTANT_TO_SHARE", constant_id);
startActivity(intent)
kdlannoy
- 103
- 1
- 8