2

I have an app that obtains a list of available Calendars and displays them in the Spinner.

I have checks to ensure that if the available Calendar list is empty, then ListPreference will still display "None available" in the Spinner.

I am using the ListPreference to display the Spinner in the Preferences tab.

Here is the preferences.xml:

<ListPreference android:title="Calendar"
android:key="calendars"
android:summary="Calendars to use for saving Appts"
android:selectable="true"
android:entryValues="@array/cal_entryvalues_list_preference"
android:entries="@array/cal_entries_list_preference"
android:defaultValue="0"
android:enabled="true"></ListPreference>

My users have reported the following error:

java.lang.NullPointerException at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java: 355) at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323) at android.widget.AbsListView.obtainView(AbsListView.java:1294) at android.widget.ListView.measureHeightOfChildren(ListView.java:1198) at android.widget.ListView.onMeasure(ListView.java:1109) at android.view.View.measure(View.java:8171) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java: 1012) at android.widget.LinearLayout.measureVertical(LinearLayout.java:381) at android.widget.LinearLayout.onMeasure(LinearLayout.java:304) at android.view.View.measure(View.java:8171) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java: 1012) at android.widget.LinearLayout.measureVertical(LinearLayout.java:381) at android.widget.LinearLayout.onMeasure(LinearLayout.java:304) at com.android.internal.widget.WeightedLinearLayout.onMeasure(WeightedLinearLayout.java: 60) at android.view.View.measure(View.java:8171) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132) at android.widget.FrameLayout.onMeasure(FrameLayout.java:245) at android.view.View.measure(View.java:8171) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132) at android.widget.FrameLayout.onMeasure(FrameLayout.java:245) at android.view.View.measure(View.java:8171) at android.view.ViewRoot.performTraversals(ViewRoot.java:801) at android.view.ViewRoot.handleMessage(ViewRoot.java:1727) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4627) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:868) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) at dalvik.system.NativeStart.main(Native Method)

The stack trace seems to be pointed all internal workings of Android. There is no reference to any of my code. This is happening on Android 2.1 as well as Android 2.2 platforms.

Unfortunately, I have not been able to reproduce the error on my Moto Droid. It appears from Developer Console logs that this is specific to certain phones (e.g: HTC Incredible).

Any idea what is going on here?

4

0 回答 0