Android的 - 下载JSON数据并保存到共享preferences [英] Android - Download JSON data and save to shared preferences

查看:160
本文介绍了Android的 - 下载JSON数据并保存到共享preferences的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从一个PHP服务,每次的是JSON变化的版本读取JSON数据,我希望将其存储在Android(用新的替换旧的数据)时,JSON仅用于填补了微调。

I'm reading JSON data from a PHP Service and everytime the version of that JSON changes, I want to store it on Android (replace the old data with the new one), the JSON is used only for fill a Spinner.

我的问题是: - 在JSON有36KB,是确定其存储在共享preferences有一个String或者我应该使用SQLite来存储它

My question is: - The JSON has 36KB, is OK to store it on Shared Preferences has a String or should I use SQLite to store it?

将有每月一次更新

例: http://zimp.hugo.webe.pt/api /职业/列表

推荐答案

如果它是一个JSON字符串,有许多记录,价值观,那么我会建议,解析字符串为记录,然后将这些记录保存到源码,使你不会需要重新解析这个字符串,并再次,未必然。否则,没有拯救串入的共享preferences任何问题。

if its a json String, having many records, values, then I would recommend to parse this string into records, and then save these records to sqlite, so that you wont need to parse this string again, and again, un-necessarily. otherwise, there isn't any issue in saving string into sharedpreferences.

根据你的数据,你应该选择的SQLite。

According to your data, you should opt for SQLite.

这篇关于Android的 - 下载JSON数据并保存到共享preferences的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆