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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -