I actually figured out I just needed to create static boolean
variables and have a onPreferenceClickListener to store the most
recent value of the preference and then have the getGPSOption return
that static boolean.
The real error was something else in the code that caused it to crash.

On Mar 30, 4:38 pm, Mark Murphy <[email protected]> wrote:
> Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine
> LogCat and look at the stack trace associated with your "crash".
>
>
>
> On Tue, Mar 29, 2011 at 2:55 PM, agrosner <[email protected]> wrote:
> > okay so here it is:
> > public static boolean getGPSOption(Context context){
> >                return
> > PreferenceManager.getDefaultSharedPreferences(context).getBoolean(GPS_SENSOR,
> > true);
> >        }
> > this seems to work perfectly when it is selected in preferences, but
> > when I try to access it in another class by
> > XYZ = Prefs.getGPSOption(this);
> > and the option is deselected, My application crashes.
>
> > Why is it only working for true values (ie when the checkboxpreference
> > is selected) and not false?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_ Version
> 1.9.2 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to