你好,我的应用程序工作在两种模式,即离线模式和online.When模式,我的应用程序为脱机模式做准备,捕获json并将其保存在database.In联机模式中,它表示图像和文本,但在脱机模式中,它只是应该表示缓存的文本和图像,但它没有。为什么?(我认为它接收到图像,但不表示它).what应该这样做吗
protected Integer doInBackground(Void... params) {
arraylist = new ArrayList<HashMap<String, String>>();
jsonarray = JSONfunctions.getJSONfromURL(mUrl2);
if ( internetpresent )
{
db = new DatabaseHelper(getApplicationContext());
for (int i = 0; i < jsonarray.length(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
jsonobject = jsonarray.getJSONObject(i);
// Retrive JSON Objects
map.put("id", jsonobject.getString("id"));
map.put("title", jsonobject.getString("title"));
map.put("type1", jsonobject.getString("type1"));
map.put("type", jsonobject.getString("type"));
map.put("matn", jsonobject.getString("matn"));
map.put("date", jsonobject.getString("date"));
map.put("address", jsonobject.getString("address"));
arraylist.add(map);
long id = db.InsertNewEntity(jsonobject.getInt("id"),jsonobject.getString("title"),
jsonobject.getString("type"),jsonobject.getString("matn"),jsonobject.getString("date"),hid
,jsonobject.getString("type1"),jsonobject.getString("_new"),jsonobject.getString("address"));
}发布于 2014-11-11 09:33:50
试试下面的一个。
Nostra的通用图像加载器- https://github.com/nostra13/Android-Universal-Image-Loader
毕加索- http://square.github.io/picasso/
两者都非常适合离线缓存图像。
https://stackoverflow.com/questions/26860651
复制相似问题