I have two methods in activity
private void save(String tag, final boolean isChecked) { SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean(tag, isChecked); editor.commit(); } private boolean load(String tag) { SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE); return sharedPreferences.getBoolean(tag, false); }
and I will not statically load the load to get load values ββfrom another static method within the same activity. However, when I try to make the loading method static, I certainly get an error due to a non-static link. How can I do this job?
I tried this access to SharedPreferences using static methods with no luck.
Any help would be greatly appreciated!
android static sharedpreferences
mikez Jun 05 '11 at 6:17 2011-06-05 06:17
source share