user412759
user412759

Reputation: 2415

The performance of GestureOverlayView and GestureDetector

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?

Upvotes: 7

Views: 1373

Answers (1)

Romain Guy
Romain Guy

Reputation: 98501

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.

Upvotes: 11

Related Questions