danoz73 / RecyclerViewFastScroller

A Fast Scroller for the RecyclerView world!
Other
1.13k stars 211 forks source link

Crash on setRecyclerView #40

Open votruk opened 9 years ago

votruk commented 9 years ago

Hi! I use RecycleView 22.2.1 version and get fatal exception after attemting to set my RecycleView to VerticalRecyclerViewFastScroller via method setRecyclerView. Here's the exception:

java.lang.NullPointerException: Attempt to invoke virtual method 'void xyz.danoz.recyclerviewfastscroller.vertical.VerticalRecyclerViewFastScroller.setRecyclerView(android.support.v7.widget.RecyclerView)' on a null object reference

It seems like the same problem as https://github.com/danoz73/RecyclerViewFastScroller/issues/21

And I have another question. Method setOnScrollListener is deprecated now. Should I use addOnScrollListener instead? Is it compatible with your implementation of fast scroll?

Btw, thnx a lot for your lib )

taciosd commented 8 years ago

Probably you already solved this, but if you are calling setRecyclerView and get a NPE is because you are not passing a valid RecyclerView. Check if you are inflating the RecyclerView correctly when calling findViewById, and if you a passing a non null RecyclerView object to setRecyclerView.

The method setOnScrollListener is deprecated because now you can register more than one ScrollListener in the RecyclerView. So you are correct, use addOnScrollListener.