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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -