Terazilla wrote:Has anyone had problems retrieving their shared preferences? I was under the impression that it created an empty one if no current prefs were saved, but I'm getting a crash instead. Basically, I've got a section in my default activity's constructor that reads like this:
SharedPreferences prefs = getSharedPreferences( "MyPrefsName", 0 );
onSharedPreferenceChanged( prefs, "MyPrefsName" );
It doesn't even get as far as onSharedPreferenceChanged, instead I get a crash in some non-visible code immediately upon hitting getSharedPreferences! All the examples I've found online are doing the same thing I am, I think. The callstack says it's caused by a null pointer exception?
If I commented out getSharedPreferences the app launches just fine, and I can launch my PreferencesActivity screen, change some options, and back out no problem. =(
My previous project was a Live Wallpaper and doing the above seemed to work just fine. Can anybody help?
Users browsing this forum: No registered users and 20 guests