1

I am trying to implement custom FastScrollListener which is working fine on every platform except Android Lollipop where its crashing on the following line:

final Field fastScrollerField = AbsListView.class.getDeclaredField("mFastScroller");

saying:

12-14 16:46:29.034: E/AndroidRuntime(29702): Caused by: java.lang.NoSuchFieldException: mFastScroller
12-14 16:46:29.034: E/AndroidRuntime(29702): at java.lang.Class.getDeclaredField(Class.java:886)

Can anyone guide me about the fix for Android Lollipop.

Ali Ansari
  • 219
  • 3
  • 14
  • "which is working fine on every platform except Android Lollipop" -- and also except any device where the manufacturer or ROM modder changed `AbsListView` to no longer have `mFastScroller`, or to change its data type, etc. Do not rely upon internal implementation. – CommonsWare Dec 14 '14 at 12:27
  • So, the fix is not to rely upon internal implementation then how can i do it? – Ali Ansari Dec 14 '14 at 12:33
  • Since `FastScrollListener` is not part of the Android SDK either, you simply don't do "it" at all. I have no idea what actual business problem you are trying to solve, I have no means of advising you on how to solve that business problem without resorting to unreliable techniques. – CommonsWare Dec 14 '14 at 12:58

1 Answers1

1

Found the solution be comparing AbsListView of Lollipop with previous versions and found out the the keyword/name for getting declared feild is changed to mFastScroll from mFastScroller...

Ali Ansari
  • 219
  • 3
  • 14