Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The performance of GestureOverlayView and GestureDetector

Tags:

android

I am using GestureOverlayView with ViewFlipper, and it takes about one second for the android to recognize my gesture and flip to next view. However, the Android calendar flips almost immediately. I checked the Android calendar code, and it uses GestureDetector. Is there big difference between these two gesture detecting mechanisms?

I am also wondering what's the difference between these two mechanism of detecting gestures. I know GestureOverlayView came out at 1.6, while GestureDetector was in 1.0. But why didn't they just deprecate GestureDetector when GestureOverlayView came out?

like image 876
user412759 Avatar asked Aug 24 '10 06:08

user412759


1 Answers

These two components have two different goals. GestureDetector is meant to detect common, simple and non visual gestures like scrolls, flings, swipes, etc. GestureOverlayView is meant to detect complex gestures (arbitrary shapes, letters, etc.) that are drawn on screen. Because of its nature GestureOverlayView relies on timings before it starts recognizing a shape. It's not a matter of performance. If all you want to do is detect a swipe, just use a GestureDetector.

like image 118
Romain Guy Avatar answered Nov 11 '22 02:11

Romain Guy