android - whether the permanent value returned by these methods? -



android - whether the permanent value returned by these methods? -

activity.getpreferences(mode) , sharedpreferences.edit() can this?

(at activity class):

//... private sharedpreferences pref; private editor editor; oncreate() { pref = getpreferences(activity.mode_private); editor = pref.edit(); } ondestroy() { int somesavedint = pref.getint("someint", 0); editor.putint("someint", somesavedint * 2); } //...

or before utilize should value of pref , editor?

you can create static variable of shared preference too. or can each time, both fine.

just maintain in mind have editor.commit(); save/commit these values always.

android

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -