How to Cache Json data to be available offline?

后端 未结 7 2309
隐瞒了意图╮
隐瞒了意图╮ 2020-12-08 12:55

I have parsed the JSON Data in a listview and now I want to make it available offline. Is there a way to save the JSON data at the phone so that you can see th

7条回答
  •  既然无缘
    2020-12-08 13:03

    You have two ways. Either you create a database and save all of the data there and retrieve it back when you want to. Or if the data you have is not that much and you don't want to deal with databases, then you write the json string to a text file in the memory card and read it later when you are offline.

    And for the second case, every time you go online, you can retrieve the same json from your web service and over write it to the old one. This way you can be sure that you have the latest json saved to the device.

提交回复
热议问题