I’m getting a null pointer on a shared pref. But shared prefs always require a default value. So wouldn’t that make it impossible.
Adding this code snippet (roughly) gives me the problem (according to logcat):
myPrefs = getSharedPreferences("myPrefs", 0);
String lvl_result= myPrefs
.getString(lvl, null);
// Example "A -> a" or null
if (lvl_result.equals(null)) {
gen_lvl();
lvl_result = myPrefs.getString(lvl, null);
}
Logcat (not sure if this is what you want to see):
12-04 00:54:42.932: E/AndroidRuntime(763): Caused by: java.lang.NullPointerException
Replace following line in your code:
with
if the
lvl_resultisnullthen callingequalsmethod on this object would raise the null pointer exception..