Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion nullpointer on getPreferenceManager() in sdk 13 and up

Received: by 10.52.77.97 with SMTP id r1mr20756195vdw.4.1328085541732;
        Wed, 01 Feb 2012 00:39:01 -0800 (PST)
X-BeenThere: android-developers@googlegroups.com
Received: by 10.220.240.68 with SMTP id kz4ls2503097vcb.1.gmail; Wed, 01 Feb
 2012 00:38:17 -0800 (PST)
MIME-Version: 1.0
Received: by 10.236.197.100 with SMTP id s64mr2289315yhn.5.1328085497164; Wed,
 01 Feb 2012 00:38:17 -0800 (PST)
Authentication-Results: ls.google.com; spf=pass (google.com: domain of
 dirkvrancka...@gmail.com designates internal as permitted sender)
 smtp.mail=dirkvrancka...@gmail.com; dkim=pass
 header...@gmail.com
Received: by h6g2000yqk.googlegroups.com with HTTP; Wed, 1 Feb 2012 00:38:17
 -0800 (PST)
Date: Wed, 1 Feb 2012 00:38:17 -0800 (PST)
In-Reply-To: <CALLdnhN49pogYBe_9AHAiO7XSY5kxi5nd9fAaCH-nne09494qw@mail.gmail.com>
References: <1fd7d893-f57a-427f-af5e-f646b4eb0a8e@c6g2000vbk.googlegroups.com> <CALLdnhN49pogYBe_9AHAiO7XSY5kxi5nd9fAaCH-nne09494qw@mail.gmail.com>
User-Agent: G2/1.0
X-HTTP-Via: ICAP/1.0 150.45.86.251
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7
 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7,gzip(gfe)
Message-ID: <d01fc076-1910-4e01-af28-b5334e42db2a@h6g2000yqk.googlegroups.com>
Subject: Re: nullpointer on getPreferenceManager() in sdk 13 and up
From: Dirk Vranckaert <dirkvrancka...@gmail.com>
To: Android Developers <android-developers@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thank Mark, that did indeed help!

On Jan 31, 3:37=A0pm, 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 {
> > =A0 =A0@Override
> > =A0 =A0protected void onCreate(Bundle savedInstanceState) {
> > =A0 =A0 =A0 =A0super.onCreate(savedInstanceState);
> > =A0 =A0 =A0 =A0PreferenceManager preferenceManager =3D
> > PreferencesICSActivity.this.getPreferenceManager();
>
> > preferenceManager.setSharedPreferencesName(Constants.Preferences.PREFER=
ENCE S_NAME);
> > =A0 =A0}
> > ...
> > }
>
> > 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-develop...@googlegroups.co=
m
> > 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=3Den
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commo=
nsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>