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


Solutions on the web1

Solution icon of github
Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference

Stack trace

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(IndexLayoutManager.java:57)
	at br.com.stickyindex.listener.IndexScrollListener.notifySubscribers(IndexScrollListener.java:43)
	at br.com.stickyindex.listener.IndexScrollListener.onScrolled(IndexScrollListener.java:26)
	at android.support.v7.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:3630)
	at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2784)
	at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:2971)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:562)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1626)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1000)
	at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:710)
	at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
	at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:982)
	at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:723)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:907)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
	at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
	at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
	at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
	at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
	at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
	at android.view.View.layout(View.java:15671)
	at android.view.ViewGroup.layout(ViewGroup.java:5038)
	at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2086)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1843)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
	at android.view.Choreographer.doCallbacks(Choreographer.java:580)
	at android.view.Choreographer.doFrame(Choreographer.java:550)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
	at android.os.Handler.handleCallback(Handler.java:739)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.