Search code examples
androidandroid-layoutandroid-gesture

pinch to zoom multi-touch feature in Android


Hello Everybody,

I was searching Android multitouch (pinch zoom) in so many sites but couldn't find any appropriate answer, I have found one link http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html in which he suggested to use private ScaleGestureDetector mScaleDetector; but ScaleGesturesDetector requires android 2.2 froyo. Then what will we do for below 2.2. Is there any example code or solution ?

your valuable time will be helpful to me ..thanks in advance


Solution

  • Due to the varying levels of support for multitouch on earlier Android devices (i.e. generally none), I'd suggest that if ScaleGestureDetector is not available on the device, you simply provide on-screen zoom in/out buttons.

    This page gives a good explanation of how you can detect if certain APIs are available (i.e. ScaleGestureDetector on 2.2 and higher), allowing your app to degrade gracefully if they're not (i.e. with buttons if lower than 2.2) http://blog.radioactiveyak.com/2011/01/how-to-use-gyroscope-api-and-remain.html