java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()'

来源:互联网 发布:阿里巴巴的大数据包括 编辑:程序博客网 时间:2024/06/05 03:26

java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.lang.Integer.intValue()’ on a null object reference

 FATAL EXCEPTION: main                                                                   Process: com.fjrcloud.fuqing, PID: 9885                                                                   java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference                                                                       at com.chad.library.adapter.base.BaseMultiItemQuickAdapter.getLayoutId(BaseMultiItemQuickAdapter.java:52)                                                                       at com.chad.library.adapter.base.BaseMultiItemQuickAdapter.onCreateDefViewHolder(BaseMultiItemQuickAdapter.java:48)                                                                       at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:681)                                                                       at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:68)                                                                       at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6367)                                                                       at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5555)                                                                       at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440)                                                                       at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436)                                                                       at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)                                                                       at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)                                                                       at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)                                                                       at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)                                                                       at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)                                                                       at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3025)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)                                                                       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)                                                                       at android.support.v7.widget.CardView.onMeasure(CardView.java:211)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)                                                                       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)                                                                       at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)                                                                       at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)                                                                       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)                                                                       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)                                                                       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)                                                                       at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)                                                                       at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)                                                                       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)                                                                       at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)                                                                       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)                                                                       at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)                                                                       at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)                                                                       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)                                                                       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)                                                                       at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)                                                                       at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)11-15 10:06:28.023 9885-9885/com.fjrcloud.fuqing E/AndroidRuntime:     at android.view.View.measure(View.java:19759)                                                                       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6122)                                                                       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)                                                                       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:690)                                                                       at android.view.View.measure(View.java:19759)                                                                       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2317)                                                                       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1404)                                                                       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1653)                                                                       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1292)                                                                       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6368)                                                                       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:873)                                                                       at android.view.Choreographer.doCallbacks(Choreographer.java:685)                                                                       at android.view.Choreographer.doFrame(Choreographer.java:621)                                                                       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:859)                                                                       at android.os.Handler.handleCallback(Handler.java:754)                                                                       at android.os.Handler.dispatchMessage(Handler.java:95)                                                                       at android.os.Looper.loop(Looper.java:163)                                                                       at android.app.ActivityThread.main(ActivityThread.java:6321)                                                                       at java.lang.reflect.Method.invoke(Native Method)                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

今天遇到这个报错,报错java.lang.Integer.intValue() 找了半天。。。其实这个是获取某个int值报空。我的问题出在适配器中申明了多布局,只设置了两种,然而实际定义的布局有三种。要保证适配器中获取的类型个数跟你所给数据的类型个数相同!!!切记

阅读全文
0 0
原创粉丝点击