2

Is there a possibility for Android to detect if an gesture (swipe, zooming, etc.) has finished?

I need that in the onDraw method of my ImageView to optimize the performance.

Thanks!

Patrick
  • 678
  • 8
  • 16
  • There's no need to put the tag in the subject (and you had a typo there anyway). The tags you assign to the question are enough to identify that it's about Android. – Ken White Mar 12 '11 at 16:42

1 Answers1

0

You could extend LinearLayout or whatever ViewGroup you are using. Then you can override the onTouchEvent() of your Base-class or if you need more control over the Event you can override onInterceptTouchEvent() method. In these method you have Access to a MotionEvent.

Then you can use GestureDetector to detect any Gestures related to the MotionEvent.

Usually you would use this to do anything magical with the gesture and let your app react on the gesture. But you can use it in your case to know then a gesture has finished.

Hope that helps.

Chris
  • 7,675
  • 8
  • 51
  • 101
  • I can't follow your advice, can you please post a code snippet? – Patrick Mar 12 '11 at 18:41
  • I'm sorry i can't post a code snippet because i would have to write an example application where i could test this. Are you familiar with java programming and object orientation? – Chris Mar 12 '11 at 19:19
  • For sure. I don't understand how I can detect that the Gesture has finished width your advice above. Can you explain that a little bit more? – Patrick Mar 12 '11 at 19:48
  • The gesture itsself has finished when the onTouchEvent is triggered i think. And at the end of that method the Gesture has finished. – Chris Mar 12 '11 at 20:15