caching - how can i implement offline storage in android using cache? -
hi want implement offline storage in android using cache( kinvey api)?can share step wise implementation same?i searched lot don't information android cache.
cache cache = appcontroller.getinstance().getrequestqueue().getcache(); cache.entry entry = cache.get(api); if (entry != null) { try { string data = new string(entry.data, "utf-8"); jsonobject jobj = new jsonobject(data); filewriter file = new filewriter(cxt.getfilesdir().getpath() + "/" + filename); string jsonstring = jobj.tostring(); file.write(jsonstring); file.flush(); file.close(); // preparelistdata(jobj); } catch (unsupportedencodingexception e) { e.printstacktrace(); } }
Comments
Post a Comment