Account preferences crashes on ListPreference

Posted by Sionide21 on Stack Overflow See other posts from Stack Overflow or by Sionide21
Published on 2010-05-14T22:34:36Z Indexed on 2010/05/14 22:44 UTC
Read the original article Hit count: 451

Filed under:

I have created an account type using the AccountAuthenticator stuff as done in the SampleSyncAdapter tutorial. I am now trying to get account preferences working.

I have added the line android:accountPreferences="@xml/account_preferences" to my account-authenticator and account_preferences.xml looks like so:

<?xml version="1.0" encoding="utf-8"?>

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/alum_settings_title"/>

<CheckBoxPreference
    android:key="sync_alum"
    android:title="@string/sync_alum"
    android:summaryOn="@string/sync_alum_check"
    android:summaryOff="@string/sync_alum_nocheck"/>

<ListPreference
    android:key="sync_alum_since"
    android:title="@string/alum_years"
    android:entries="@array/years"
    android:entryValues="@array/years"
    android:dependency="sync_alum"/>
</PreferenceScreen>

The checkbox preference works exactly like it should but the ListPreference crashes the entire system with the following message:

05-14 22:32:16.794: ERROR/AndroidRuntime(63): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

I get the same error with EditTextPreference and with the custom subclass of DialogPreference I created.

© Stack Overflow or respective owner

Related posts about android