Get preferences in AppWidget Provider

Posted by Brian515 on Stack Overflow See other posts from Stack Overflow or by Brian515
Published on 2010-04-30T23:45:26Z Indexed on 2010/04/30 23:47 UTC
Read the original article Hit count: 303

Hi all,

I seem to be having trouble reading preferences from my AppWidgetProvider class. My code works in an Activity, but it does not in an AppWidgetProvider. Here is the code I am using to read back a boolean:

SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
boolean autoreplyon = settings.getBoolean("autoreplyon", false);

However, I get the "The method getSharedPreferences(String, int) is undefined for the type widget" error (widget is the name of my AppWidgetProvider class).

Thanks in advance for any suggestions!

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk