android - how to reprecent catched imge in offline mod -
hello app works in 2 modes i.e offline , online.when selected offline app prepare offline mode catches json , saves in database.in online mode represents image , text in offline mod it's supposed represent cached text , images,but doesn't. why ? (i think receives image doesn't represent it).what should
protected integer doinbackground(void... params) { arraylist = new arraylist<hashmap<string, string>>(); jsonarray = jsonfunctions.getjsonfromurl(murl2); if ( internetpresent ) { db = new databasehelper(getapplicationcontext()); (int = 0; < 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")); }
try 1 of libs below.
nostra’s universal image loader – https://github.com/nostra13/android-universal-image-loader
picasso – http://square.github.io/picasso/
both great caching images offline.
Comments
Post a Comment