android permanent memory -


my app different actions deppending on caller , predefined values. when call starting ring need fast possible read preferences data base , display them. tried have static variables in broadcastreceiver, tried have them in service seems die , loose values. if read them databade again takes long display information. so, there way tell android respect part of memory can persist information?

thanks

edited: reading sharedpreferences faster reading small database?

use sharedpreferences, private part of application save values permanently, untill user reinstall (clear data) application. shared preferences works this

// save string in sharedpreferences sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(getapplicationcontext());                     sharedpreferences.editor editor = settings.edit();                     editor.putstring("some_key", string); // here string value want save                     editor.commit();                      // restore string in sharedpreferences  sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(getapplicationcontext()); string = settings.getstring("some_key", ""); 

obviously can save int boolean etc instead of string


Comments

Popular posts from this blog

asp.net mvc 3 - Using mvc3, I need to add a username/password to the sql connection string at runtime -

kineticjs - draw multiple lines and delete individual line -

thumbnails - jQuery image rotate on hover -