Nick
Nick

Reputation: 2641

Fastest way to store medium term data

I am posed with a problem where I need to store an Time variable for a medium amount of time after the current activity has been Finish();.
Once the activity has been started again (only a few seconds later) I need to be able to retrieve the Time variable set in the previous activity.

What I want to know is what is the quickest and most efficient way to store the Time variable just before the activity has finished and then retrieve it once the activity has been started again.

Upvotes: 0

Views: 47

Answers (2)

danijoo
danijoo

Reputation: 2843

If its really only for a view seconds, i recommend using a singelton. SharedPreferences would be an option, too

Upvotes: 0

Naroh
Naroh

Reputation: 625

You should take a look at SharedPreferences. It's an easy and simple way to store small amounts of data.

http://developer.android.com/guide/topics/data/data-storage.html#pref

Upvotes: 1

Related Questions