0

I have this Activity with a List Fragment which loads data from server if adapter is empty. When i press the back button or go to another activity and back to this activity with Up button, the adapter is reset to empty.

So how can i save the adapter data, so the activity doesn't have to load data from the server all the time?

Thanks in advance!

PS: Sorry i don't provide any code. I just want to know the logic.

user1378381
  • 23
  • 1
  • 3

3 Answers3

0

You should save the data into local SQlite DB, and read and show it onResume().

Andrey Kopeyko
  • 1,556
  • 15
  • 14
0

Save the arraylist object which you are passing to adapter. Save it in your parent activity and get it while setting the adapter yo listview.

Use getter and setter in Activity class.

Harin
  • 2,413
  • 3
  • 15
  • 30
0

The answer to question is answered here, check this answer by Parag Chauhan Link to the answer

Community
  • 1
  • 1
DJphy
  • 1,292
  • 1
  • 17
  • 31