Detecting pinch in Android

hpique picture hpique · Apr 13, 2010 · Viewed 17.8k times · Source

I would like to handle pinch events in my Android application to zoom in and out.

I believe Android 2.0 has multi-touch functionality, and heard that Android 1.6 might or might not support it depending of the device.

What's the best way to detect pinch events, while degrading gracefully for devices that don't support it? I'm targeting Android 1.5 upwards.

Answer

Damian picture Damian · Apr 13, 2010

A great article by Ed Burnette (Hello Android Author) on multi touch (including pinch zoom) can be found here: http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2/1747

Here's an article on the Android developer blog about taking advantage of capability of the newer APIs on devices that support them, while gracefully continuing to support older devices. http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html