Reputation: 2773
I have to implement a two fingers tap.
For example I have a listView with multiple items, which already have a click listener for each row and touch listener. Now I have to do something if the user put two fingers on a row.
How can I do this?
Any suggestion is appreciated.
Upvotes: 4
Views: 9207
Reputation: 16387
I believe just the gesture API only support single touch.
You basically have to override `onTouchEvent, and play with e.getPointerCount() and check the time between the ACTION_POINTER_DOWN and ACTION_POINTER_UP. You will probably also think about the case where the two touches actually do not come at the exact same time or leave the screen at the exact same time either.
Upvotes: 3
Reputation: 835
Not sure what you mean by 2 fingers tap. If you mean a double tap (one finger, 2 taps) , I recommend this:
http://mobile.tutsplus.com/tutorials/android/android-gesture/
But if you are referring to 2 different fingers tapping once, would not recommend doing that a 2 finger tap because it goes against the Android design guidelines. If anything it is recommended to do a long press, which can easily be implemented overriding the onLongClick() method.
But if you really do not want to listen to me because you think I am stupid. You would essentially need to implement your own multi touch gesture. Here is one example:
FYI, please be aware of what android version you want to support.
Upvotes: -2
Reputation: 1761
Try this
Or
http://www.rbgrn.net/content/367-source-code-to-multitouch-visible-test
android imageView: setting drag and pinch zoom parameters
This may help you.
Upvotes: 0