在无处中间的空指针

时间:2014-09-23 07:30:22

标签: java android nullpointerexception

所以我有一个片段,其中包含一个隐藏的地图和一个可见的列表视图,该视图是从我从后端API获取的数据中填充的。我突然冒出了一个致命的崩溃,在我的代码中无处可寻。在创建列表视图后,崩溃发生在某处。

java.lang.NullPointerException
at android.view.View.onDrawScrollBars(View.java:12800)
at android.view.View.draw(View.java:15400)
at android.widget.AbsListView.draw(AbsListView.java:5242)
at android.view.View.draw(View.java:15279)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15277)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15277)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15397)
at android.view.View.draw(View.java:15279)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15277)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15277)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15277)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15397)
at android.view.View.draw(View.java:15279)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at  com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.dispatchDraw(CustomViewAbove.java:815)
at android.view.View.draw(View.java:15397)
at android.view.View.draw(View.java:15279)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15277)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15277)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15277)
at android.view.ViewGroup.drawChild(ViewGroup.java:3310)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3147)
at android.view.View.draw(View.java:15397)
at android.widget.FrameLayout.draw(FrameLayout.java:472)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2567)
at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2869)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2782)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2620)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2188)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6585)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
at android.view.Choreographer.doCallbacks(Choreographer.java:603)
at android.view.Choreographer.doFrame(Choreographer.java:573)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5586)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)

自从上次运行应用程序以来,我做了很多工作,而且我不确定是什么造成了这个问题。如果有人能指出我可以开始寻找的地方,我真的很感激。

如果您需要更多信息,我很乐意提供。

感谢一大堆,我真的很感激任何帮助。

1 个答案:

答案 0 :(得分:0)

在这个问题浪费了几个小时之后,它变成了一个库,它在过度滚动中删除了listview“发光”。

具体功能是: AbsListView.setSelector(int resID)和库传入一个ID,指的是颜色而不是需要的drawable。

非常感谢帮助过的人们,我真的很感激任何对这个问题的想法。 我希望将来能帮到任何人。