Search code examples
androidlistviewforegroundonresume

How to restore last values of listview and other views after coming app from foreground?


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 .


Solution

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

    Switching between Android activities

    Had asked the same question some time back.