title: obtainStyledAttributes fails to find arrays
body: <p>I am writing a custom DialogPreference and I setup the preference with 2 arrays of strings named <strong>entries</strong> and <strong>entryValues</strong>, similarly to what a ListPreference would need. Even though both arrays seem to be present when my constructor is called with the AttributeSet param, trying to fetch the styled arrays via obtainStyledAttributes fails by returning null.</p>
  
  <p>What am I doing wrong and how can I try to fix this?</p>
  
  <p>My custom class code is:</p>
  
  <pre><code>public class BackgroundPicker extends DialogPreference {    
  
      private CharSequence[] mEntries;
      private CharSequence[] mEntryValues;
  
      public BackgroundPicker(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
  
          // Print all values in attrs AttributeSet:
          for (int i=0;i&lt;attrs.getAttributeCount();i++) {
              String name = attrs.getAttributeName(i);
              Object value  = attrs.getAttributeValue(i);
              Log.d(TAG, name + " : " + value + " of type " + value.getClass().getSimpleName());
          }
  
          TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListPreference, 0, 0);
  
          // getIndexCount returns zero !
          for(int i=0; i&lt;a.getIndexCount(); i++) {
              TypedValue v = a.peekValue(i);
              Log.d(TAG, "value[" + i + "] = " + v.toString());
          }
  
          // Both entries and entryValues are null.
          mEntries = a.getTextArray(R.styleable.ListPreference_entries);
          mEntryValues = a.getTextArray(R.styleable.ListPreference_entryValues);
      }
  }
  </code></pre>
  
  <p>my debug print is:</p>
  
  <pre><code>BackgroundPicker CTOR: IN
  BackgroundPicker CTOR param attrs:
  entries : @2131099650 of type String
  title : @2131165247 of type String
  key : BackgroundImage of type String
  summary : @2131165248 of type String
  defaultValue : back.png of type String
  entryValues : @2131099651 of type String
  BackgroundPicker CTOR param defStyle = 0
  BackgroundPicker CTOR: OUT
  </code></pre>
  
  <p>my styles in styles.xml</p>
  
  <pre><code>&lt;declare-styleable name="ListPreference"&gt;
      &lt;attr name="entries" format="reference" /&gt;
      &lt;attr name="entryValues" format="reference" /&gt;
  &lt;/declare-styleable&gt;    
  </code></pre>
  
  <p>my data in arrays.xml</p>
  
  <pre><code>&lt;array name="Backgrounds"&gt;
      &lt;item&gt;back.png&lt;/item&gt;
      &lt;item&gt;one.png&lt;/item&gt;
  &lt;/array&gt;
  </code></pre>
  
  <p>and my preferences setup:</p>
  
  <pre><code>&lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" &gt;
      &lt;PreferenceCategory android:title="@string/generaloptions" &gt;
          &lt;BackgroundPicker
              android:defaultValue="back.png"
              android:entries="@+array/Backgrounds"
              android:entryValues="@+array/Backgrounds"
              android:key="BackgroundImage"
              android:summary="@string/backgroundImageSummary"
              android:title="@string/backgroundImage" /&gt;
      &lt;/PreferenceCategory&gt;
   &lt;/PreferenceScreen&gt;
  </code></pre>