How can i integrate GestureDetector with onItemLongClick?
I have a GridView containing three images. When I touch on the first image, I want to display a Toast message. When I lift up my finger from the screen, I want to display a second Toast message.
I know that GestureDetector uses MotionEvent, but onItemLongClick does not. But in this case, I would need to keep track of the image’s position ID in the grid, thus it is not possible to implement inside onTouch()?
You can track the motion of the cursor, whether its a onscreen touch or a TrackBall move, using this class and if it crosses over into the next picture you can handle that event then. Here is an example taken from the sdk examples:
You can read more and see the file in your SDK at C:\YourInstallDir\android-sdk\samples\android-10\ApiDemos\src\com\example\android\apis\graphics\TouchPaint.java or just search the whole examples files for MotionEvent there’s a few more uses in them.