Android List Preference in xml causing Array Index of Bounds error
<p>Hi I have an xml which is used for android preference activity.
When I remove the code below from my xml the error is gone, and I can't figure it Out why, I have only these two list preferences in my xml others are switch preference etc and they are working fine.</p>

<p>Xml Code which is causing error: </p>

<pre><code> &lt;ListPreference
        android:defaultValue="-1"
        android:entries="@array/pref_example_list_titles"
        android:entryValues="@array/pref_list_entry_values"
        android:key="select"
        android:title="title1" /&gt;
    &lt;ListPreference
        android:defaultValue="-1"
        android:entries="@array/length_list_titles"
        android:entryValues="@array/list_entry_values"
        android:key="length"
        android:title="title2" /&gt;
</code></pre>

<p>Exception Raised During Error:</p>

<pre><code>STACK TRACE:
java.lang.ArrayIndexOutOfBoundsException: 2
    at android.preference.ListPreference.getEntry(ListPreference.java:220)
    at android.preference.ListPreference.getSummary(ListPreference.java:165)
    at android.preference.Preference.onBindView(Preference.java:558)
    at android.preference.Preference.getView_Original(Preference.java:495)
    at android.preference.Preference_Delegate.getView(Preference_Delegate.java:44)
    at android.preference.Preference.getView(Preference.java:492)
    at android.preference.PreferenceGroupAdapter.getView(PreferenceGroupAdapter.java:246)
    at android.widget.AbsListView.obtainView(AbsListView.java:2346)
    at android.widget.ListView.makeAndAddView(ListView.java:1875)
    at android.widget.ListView.fillDown(ListView.java:702)
    at android.widget.ListView.fillFromTop(ListView.java:763)
    at android.widget.ListView.layoutChildren(ListView.java:1684)
    at android.widget.AbsListView.onLayout(AbsListView.java:2148)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
    at android.view.View.layout(View.java:16630)
    at android.view.ViewGroup.layout(ViewGroup.java:5437)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:362)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:428)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:510)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:498)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:967)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:498)
    at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:72)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:610)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:607)
    at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:359)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:607)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:629)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:652)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:80)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:594)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:589)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
    at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
</code></pre>