How to make JsonArray cache in android -


i need store jsonarray retrived server store in cache.i tried several method;but not creating cache file.my code given below

public class makecache {  public void vehiclecache(){     string json_url = "http://domainname.com/api/vehicle";      jsonarrayrequest jsonobjectrequest=new jsonarrayrequest(json_url,new response.listener<jsonarray>(){         @override         public void onresponse(jsonarray response) {             log.d("vehicles", response.tostring());             try {                 objectoutput out = new objectoutputstream(new fileoutputstream(new file(g.context.getcachedir(), "") + "lpavehicle.srl"));                 out.writeobject(response);                 out.close();             }catch (ioexception ex){                 log.d("file",ex.getmessage());             }         }     }, new response.errorlistener() {         @override         public void onerrorresponse(volleyerror error) {             volleylog.d("vehicles_error", "error: " + error.getmessage());          }     });      // adding request request queue     appcontroller.getinstance().addtorequestqueue(jsonobjectrequest); } 

i need create json cache

you can save jsonarray string sharedpreference example


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -