0

How do I save previous activity and have that update into a listview so that when a user launches the app at a later time he can click on a menu option called history which will bring a listview of the last few activities. Let's say the listview holds 5 activies and after the 5 activies it deletes the oldest activity saved and saves the new activity in it's place.

For example if someone wants to view history of an android activity that he viewed two days ago, he can simply click on a button called history and view his past 5 entries which will be displayed in a listview.

Any ideas?

K D
  • 115
  • 1
  • 3
  • 12

1 Answers1

0

You can't do it by default Android Activities method.

Just save state in onResume/onCreate (as file in filesystem or SharedPreference) and read it from yours History Activity.

Sorry for bad english)) Ask if don't understand something.

JaLoveAst1k
  • 512
  • 3
  • 14
  • Ok I see what your saying. Would I have to create a method that saves state of activity like: public void save(Intent k){ have this as current activity} and call this method each time I start an activity with an onClickEvent. Something like: Intent i = new intent(this, fish.class); startacvity(i); save(i); and from there pass that save(i) method with the current activity to putString SharedPrefrences method which I can use to call back to restore previous prefrences? – K D Jul 07 '12 at 03:51
  • Great I almost got this to work. THing is how do I read the data (a string value) from my sharedPreference into a ListView row? – K D Jul 17 '12 at 18:46