android - sharedpreferences not created -


i created application store jsonarray using sharedpreferences server.but not created sharedpreference.

sharedpreferences sharedpreferences; public void vehiclecache(){     string json_url = "http://domain.com/api/vehicle";      jsonarrayrequest jsonobjectrequest=new jsonarrayrequest(json_url,new response.listener<jsonarray>(){         @override         public void onresponse(jsonarray response) {             log.d("vehicles", response.tostring());             sharedpreferences= preferencemanager                     .getdefaultsharedpreferences(g.context);             sharedpreferences.editor editor=sharedpreferences.edit();             editor.putstring("vehicles",response.tostring());             editor.commit();         }     }, new response.errorlistener() {         @override         public void onerrorresponse(volleyerror error) {             volleylog.d("vehicles_error", "error: " + error.getmessage());          }     });      // adding request request queue     appcontroller.getinstance().addtorequestqueue(jsonobjectrequest); } 

try way sharedpreferences shared=preferencemanager.getdefaultsharedpreferences(getapplicationcontext());
sharedpreferences.editor editor=shared.edit();


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 -