views:

40

answers:

3

When i click home button and then come back to to my application it doesn't show the last values on the listview or any other view it just look same with when i started the application.I believe it is can be done with onResume and onPause but i couldn't find how .

A: 

You can store all values in SharedPreferences in onPause, and then load them again in onResume and populate your views using that data.

EboMike
A: 

Multiple ways to do this:

  1. An SQLite database
  2. Store the data as a file on the SD card.
  3. SharedPreferences for the activity.
  4. As a static variable in the Application class.

http://stackoverflow.com/questions/3682746/switching-between-android-activities

Had asked the same question some time back.

Abhinav
A: 

To get a full understanding, read about activity lifecycles and saving activity state here.

RickNotFred