tangjie
tangjie

Reputation: 477

Why Android throws NullPointerException?

I wrote a PreferenceActivity, its setting.xml includes the following code:

        <ListPreference 
     android:key="key"
     android:title="@string/title"
     android:entries="@array/entries"
     android:entryValues="@array/values">        
    </ListPreference>

And I supply the following in array.xml

<array name="entries"><item>displayName</item></array>
<array name="values"><item>10240</item></array>

When the <item> is 10240, Android will throw NullPointerException. But when I changes it to 10240k, Android will work.Why?

Upvotes: 0

Views: 241

Answers (1)

adamp
adamp

Reputation: 28932

Try a <string-array> instead.

Upvotes: 1

Related Questions