Wednesday, February 1, 2012

[android-developers] Re: nullpointer on getPreferenceManager() in sdk 13 and up

Thank Mark, that did indeed help!

On Jan 31, 3:37 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> getPreferenceManager() looks like it will return null if you are using
> preference headers. My guess is that you are supposed to use the
> PreferenceManager from your PreferenceFragments.
>
> On Tue, Jan 31, 2012 at 9:22 AM, Dirk Vranckaert
>
>
>
>
>
>
>
>
>
> <dirkvrancka...@gmail.com> wrote:
> > I'm trying to implement a fragemented preferences activity.
>
> > This is only the first part of my activity where it already fails:
>
> > public class PreferencesICSActivity extends PreferenceActivity {
> >    @Override
> >    protected void onCreate(Bundle savedInstanceState) {
> >        super.onCreate(savedInstanceState);
> >        PreferenceManager preferenceManager =
> > PreferencesICSActivity.this.getPreferenceManager();
>
> > preferenceManager.setSharedPreferencesName(Constants.Preferences.PREFERENCE S_NAME);
> >    }
> > ...
> > }
>
> > I used to do the same in sdk version 7, there it worked. Now however
> > the getPreferenceManager() is null...
> > What am I doing wrong?
>
> > Kr,
>
> > Dirk Vranckaert
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com
> > 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 Android Development_ Version 3.7 Available!

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

No comments:

Post a Comment