Good day. I have a news feed in my application ( RecyclerView , which is filled with an adapter. When you pull -e, new items are added to recyclerview ). When moving from this fragment to another and back - the entire list disappears and the list is loaded again.

Question: how to save the list correctly so that you do not download it again each time? For example applications Vk, Pikabu, etc. the loaded tape is always saved if you switch screens or just exit the application.

Possible solution: You can save all the data in the database, when you pull add new lines to the database, but it seems to me that some other mechanism is used there.

  • Look here. In general, yes - in the database you have to push. - Yuriy SPb
  • about SharePreferences , I know. So all the same DB .. And how much line should be stored in the database for the tape? 100 lines? Suppose if you add in update 20 and delete the bottom 20 rows in the database - ivanovd422
  • Yes, at least 10 000) - YuriySPb
  • @ Denis422, stupid question about the number of lines. Since you can keep at least everything. As an option, you can add the functionality of DB / "cache" cleaning)) - Vitalii Obideiko

0