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

Stack Overflow | Huy Tower | 3 weeks ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to poroszd and Rafael Fischer Viola . Or join the community to write better ones.
  1. 0

    Set dynamic layout height in data binding

    Stack Overflow | 3 weeks ago | Huy Tower
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
  2. 0
    samebug tip
    Call notifyDataSetChanged instead of notifyItemRemoved due to a bug in RecyclerView
  3. 0
    samebug tip
    This probably occurs because you are calling notifyItemInserted(position);, notifyItemChanged(position), or notifyItemRemoved(position); from a background thread (or from a callback, which runs on a background thread). Use a Handler to solve it.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    Try to reset the previous listener before making any changes to the view.
  6. 0

    GitHub comment 51#198079407

    GitHub | 11 months ago | loganSims
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String gov.wa.wsdot.android.wsdot.shared.AmtrakCascadesScheduleItem.getScheduledDepartureTime()' on a null object reference at gov.wa.wsdot.android.wsdot.ui.amtrakcascades.AmtrakCascadesSchedulesDetailsFragment$ ScheduleAdapter.onBindViewHolder(AmtrakCascadesSchedulesDetailsFragment.java:725)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference

      at databinding.ItemGroupCommentsBinding.executeBindings()
    2. databinding
      ItemGroupCommentsBinding.executeBindings
      1. databinding.ItemGroupCommentsBinding.executeBindings(ItemGroupCommentsBinding.java:147)
      1 frame
    3. android.databinding
      ViewDataBinding.executePendingBindings
      1. android.databinding.ViewDataBinding.executePendingBindings(ViewDataBinding.java:355)
      1 frame
    4. view.base.adapter
      DataBindingAdapter.onBindViewHolder
      1. view.base.adapter.DataBindingAdapter.onBindViewHolder(DataBindingAdapter.java:32)
      2. view.base.adapter.DataBindingAdapter.onBindViewHolder(DataBindingAdapter.java:15)
      2 frames
    5. Android v7
      RecyclerView.onLayout
      1. android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6279)
      2. android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6312)
      3. android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5258)
      4. android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5521)
      5. android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5363)
      6. android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5359)
      7. android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2141)
      8. android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556)
      9. android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1488)
      10. android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:585)
      11. android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
      12. android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3506)
      13. android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3254)
      14. android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3767)
      14 frames
    6. Android Platform
      ViewGroup.layout
      1. android.view.View.layout(View.java:15604)
      2. android.view.ViewGroup.layout(ViewGroup.java:4966)
      2 frames
    7. Android Support v4
      SwipeRefreshLayout.onLayout
      1. android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:636)
      1 frame
    8. Android Platform
      FrameLayout.onLayout
      1. android.view.View.layout(View.java:15604)
      2. android.view.ViewGroup.layout(ViewGroup.java:4966)
      3. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
      4. android.view.View.layout(View.java:15604)
      5. android.view.ViewGroup.layout(ViewGroup.java:4966)
      6. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      7. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      8. android.view.View.layout(View.java:15604)
      9. android.view.ViewGroup.layout(ViewGroup.java:4966)
      10. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      11. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      12. android.view.View.layout(View.java:15604)
      13. android.view.ViewGroup.layout(ViewGroup.java:4966)
      14. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
      15. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
      16. android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
      17. android.view.View.layout(View.java:15604)
      18. android.view.ViewGroup.layout(ViewGroup.java:4966)
      19. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      20. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      21. android.view.View.layout(View.java:15604)
      22. android.view.ViewGroup.layout(ViewGroup.java:4966)
      23. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      24. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      25. android.view.View.layout(View.java:15604)
      26. android.view.ViewGroup.layout(ViewGroup.java:4966)
      27. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
      28. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
      29. android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
      30. android.view.View.layout(View.java:15604)
      31. android.view.ViewGroup.layout(ViewGroup.java:4966)
      32. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      33. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      33 frames