java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference

GitHub | Isolus | 2 years ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael . Or join the community to write better ones.
  1. 0
    samebug tip
    This issue was solved in 2.2.6. If updating doesn't solve, try using notifyItemRangeChanged(1, mDatas.size()) instead of notifyItemRangeChanged(0, mDatas.size()).
  2. 0
    samebug tip
    If you're using notifyItemChanged(position) try changing it for notifyDataSetChanged().
  3. 0
    samebug tip
    Also, you should dispatch events as soon as they happen, ReciclerView already bundles all updates.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    stickyindex expects at least two elements

    GitHub | 2 years ago | Isolus
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
  6. 0
    samebug tip
    This happens when you have android:animateLayoutChanges set to true in your XML file and you call notifyDataSetChanged(). To fix it, you have to set android:animateLayoutChanges to false.

    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 'android.view.View android.view.View.findViewById(int)' on a null object reference

      at br.com.stickyindex.layout.IndexLayoutManager.update()
    2. br.com.stickyindex
      IndexScrollListener.onScrolled
      1. br.com.stickyindex.layout.IndexLayoutManager.update(IndexLayoutManager.java:57)
      2. br.com.stickyindex.listener.IndexScrollListener.notifySubscribers(IndexScrollListener.java:43)
      3. br.com.stickyindex.listener.IndexScrollListener.onScrolled(IndexScrollListener.java:26)
      3 frames
    3. Android v7
      RecyclerView.onLayout
      1. android.support.v7.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:3630)
      2. android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2784)
      3. android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:2971)
      3 frames
    4. Android Platform
      ViewGroup.layout
      1. android.view.View.layout(View.java:15671)
      2. android.view.ViewGroup.layout(ViewGroup.java:5038)
      3. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
      4. android.view.View.layout(View.java:15671)
      5. android.view.ViewGroup.layout(ViewGroup.java:5038)
      5 frames
    5. Android Support v4
      SwipeRefreshLayout.onLayout
      1. android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:562)
      1 frame
    6. Android Platform
      ViewGroup.layout
      1. android.view.View.layout(View.java:15671)
      2. android.view.ViewGroup.layout(ViewGroup.java:5038)
      2 frames
    7. Android Support v4
      ViewPager.onLayout
      1. android.support.v4.view.ViewPager.onLayout(ViewPager.java:1626)
      1 frame
    8. Android Platform
      ViewGroup.layout
      1. android.view.View.layout(View.java:15671)
      2. android.view.ViewGroup.layout(ViewGroup.java:5038)
      2 frames
    9. android.support.design
      CoordinatorLayout.onLayout
      1. android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1000)
      2. android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:710)
      3. android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
      4. android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:982)
      5. android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:723)
      5 frames
    10. Android Platform
      ViewGroup.layout
      1. android.view.View.layout(View.java:15671)
      2. android.view.ViewGroup.layout(ViewGroup.java:5038)
      2 frames
    11. Android Support v4
      DrawerLayout.onLayout
      1. android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:907)
      1 frame
    12. Android Platform
      Handler.handleCallback
      1. android.view.View.layout(View.java:15671)
      2. android.view.ViewGroup.layout(ViewGroup.java:5038)
      3. android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
      4. android.widget.FrameLayout.onLayout(FrameLayout.java:514)
      5. android.view.View.layout(View.java:15671)
      6. android.view.ViewGroup.layout(ViewGroup.java:5038)
      7. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
      8. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
      9. android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
      10. android.view.View.layout(View.java:15671)
      11. android.view.ViewGroup.layout(ViewGroup.java:5038)
      12. android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
      13. android.widget.FrameLayout.onLayout(FrameLayout.java:514)
      14. android.view.View.layout(View.java:15671)
      15. android.view.ViewGroup.layout(ViewGroup.java:5038)
      16. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
      17. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
      18. android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
      19. android.view.View.layout(View.java:15671)
      20. android.view.ViewGroup.layout(ViewGroup.java:5038)
      21. android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
      22. android.widget.FrameLayout.onLayout(FrameLayout.java:514)
      23. android.view.View.layout(View.java:15671)
      24. android.view.ViewGroup.layout(ViewGroup.java:5038)
      25. android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2086)
      26. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1843)
      27. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
      28. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
      29. android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
      30. android.view.Choreographer.doCallbacks(Choreographer.java:580)
      31. android.view.Choreographer.doFrame(Choreographer.java:550)
      32. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
      33. android.os.Handler.handleCallback(Handler.java:739)
      33 frames