lines不为0且有消息时ConversationViewHolder初始化异常闪退

wfc_lemon 2019-12-24 1145

lines

获取lines不为0的消息列表

1、没有消息的时候正常

2、有消息时数据能正常获取,但初始化ConversationViewHolder报空指针,出现闪退

java.lang.NullPointerException: Attempt to read from field 'android.view.View androidx.recyclerview.widget.RecyclerView$ViewHolder.itemView' on a null object reference   at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7047)   at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6214)   at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6097)   at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6093)   at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303)   at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627)   at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)   at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665)   at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4115)   at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3832)   at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4385)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)   at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)   at android.widget.FrameLayout.onLayout(FrameLayout.java:270)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)   at android.widget.FrameLayout.onLayout(FrameLayout.java:270)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)   at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)   at android.widget.FrameLayout.onLayout(FrameLayout.java:270)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)   at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)   at android.widget.FrameLayout.onLayout(FrameLayout.java:270)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)   at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)   at android.widget.FrameLayout.onLayout(FrameLayout.java:270)   at com.android.internal.policy.DecorView.onLayout(DecorView.java:779)   at android.view.View.layout(View.java:21912)   at android.view.ViewGroup.layout(ViewGroup.java:6260)   at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3080)   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2590)

E/AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1721) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7598) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966) at android.view.Choreographer.doCallbacks(Choreographer.java:790) at android.view.Choreographer.doFrame(Choreographer.java:725) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

上传的附件:
最新回复 (1)
  • x86 2019-12-24
    引用 2
    你好,这个问题,请你在github上提个issue追踪吧
返回