English 中文(简体)
名单放弃了一种奇怪的、无效的例外。
原标题:ListPreference is throwing a strange null pointer exception

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.

这里是优惠。

<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>

我的用户报告了以下错误:

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).

这里有什么想法?

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签