1

I have a ListView and I want to detect gestures. Basically a horizontal swipe on a list item. Now I just inflate the list view and have a ViewHolder. Where should I place the GestureDetector? Should it be a variable of the ViewHolder? There is no separate view class. What should implement the callback methods? The Activity? All I have for my ListItems is a ViewHolder in the adapter. Also is swipe detected via onFling() ?

Code Droid
  • 10,344
  • 17
  • 72
  • 112
  • Looks like this is the answer. http://stackoverflow.com/questions/4030389/how-to-implement-fling-in-android-listview however I would like to know how to implement MyGestureDetector for a list view. – Code Droid Aug 03 '12 at 01:57

1 Answers1

0

Put your gesture detector in the ListActivity/ListFragment and use it to determine which list item was flung. When you implement the GestureDetector it might interfere with normal touch events so it is good to override onSingleTapUp for click events.

EDIT: this has been answered elsewhere

Community
  • 1
  • 1
roflharrison
  • 2,300
  • 23
  • 26