5

I have a ListView with an OnScrollListener and an OnItemClickListener. When I click on an item, both the onScroll() method in the OnScrollListener and the OnItemClickListener are fired.

Is there a way to prevent this behaviour? If not, how can I tell, inside onScroll(), if the user is really scrolling or he's just clicking?

Shruti
  • 1
  • 13
  • 55
  • 95
Venator85
  • 10,245
  • 7
  • 42
  • 57

1 Answers1

2

I think onScrollStateChanged should also be called with scrolling. Then you should be able to see if the state is idled or scrolling through the constants defined in OnScrollListener. Check this topic for an example.

Community
  • 1
  • 1
Sephy
  • 50,022
  • 30
  • 123
  • 131
  • Thanks! I was able to detect the start of the scrolling action by checking scrollState == SCROLL_STATE_TOUCH_SCROLL. – Venator85 Mar 12 '12 at 12:37