我的代码以外的空指针异常

我在我的代码中打开ListActivity时得到空指针异常,但所有跟踪都不是我的代码。

java.lang.NullPointerException在android.widget.AbsListView.obtainView(AbsListView.java:2606)在android.widget.ListView.makeAndAddView(ListView.java:1840)在android.widget.ListView.fillDown(ListView.java:681)在android.view.android.widget.AbsListView.onLayout(AbsListView.java:2427)android.widget.ListView.layoutChildren(ListView.java:1661)android.widget.ListView.fillFromTop(ListView.java:742)。 view.layout(View.java:14938)at android.view.ViewGroup.layout(ViewGroup.java:4601)at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1021)at android.view.View.layout(View .java:14938)在android.view.View.layout(View.java:14938)处的android.widget.FrameLayout.onLayout(FrameLayout.java:448)处的android.view.ViewGroup.layout(ViewGroup.java:4601)在android.view android.view.View.layout(View.java:14938)处的android.widget.FrameLayout.onLayout(FrameLayout.java:448)处的android.view.ViewGroup.layout(ViewGroup.java:4601)。在android.widget.Li中的ViewGroup.layout(ViewGroup.java:4601) android.widget.LineoutLayout.onLayout(LinearLayout.java:1465)android.view.View.layout()中的android.widget.LinearLayout.layoutVertical(LinearLayout.java:1552)的nearLayout.setChildFrame(LinearLayout.java:1694) .java:14938)在android.view.View.layout(View.java:14938)处的android.widget.FrameLayout.onLayout(FrameLayout.java:448)处的android.view.ViewGroup.layout(ViewGroup.java:4601)在android.view.android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2026)处的android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2212)处的android.view.ViewGroup.layout(ViewGroup.java:4601)。在android.view.ViewRootImpl上的ViewRootImpl.doTraversal(ViewRootImpl.java:1236)android.view.Choreographer $ CallbackRecord.run(Choreographer.java:791)android.view.Choreographer上的$ TraversalRunnable.run(ViewRootImpl.java:5160) .doCallbacks(Choreographer.java:591)at android.view.Choreographer.doFrame(Choreographer.java:561)at android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java: 777)在android.os.Handler.handleCallback(Handler.java:725)在android.os.Handler.dispatchMessage(Handler.java:92)在android.os.Looper.loop(Looper.java:176)在android。在com.android.internal处的java.lang.reflect.Method.invoke(Method.java:511)上的java.lang.reflect.Method.invokeNative(Native Method)处使用app.ActivityThread.main(ActivityThread.java:5365)。 os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1102)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)at dalvik.system.NativeStart.main(Native Method)

我怎么知道错误发生在哪里?


正如@iagreen所说:“具体来说,你从适配器的getView方法返回null。

在某些情况下,我在getWiew中的自定义适配器中返回null。

链接地址: http://www.djcxy.com/p/93131.html

上一篇: Null pointer exception outside my code

下一篇: android Lazy image load of ListView not working properly