Search code examples
androidimagebitmapscalegesture

Android: detect scale gesture for Android 2.1


when I ask Google (or stackoverflow.com) for a gesture detection example it always comes with the GestureDetector which is NOT available for Android 2.1 / API version 7.

So here is my problem: I use a class that inherits from View and shows one single bitmap. The bitmap-draw-method can be called together with a matrix. I plan to use this matrix to show scaled variants of that bitmap within my View.

The scale factor has to be set via a scale-gesture of the user (the two-finger-thingy where fingers go closer to each other to zoom out or where the user spreads them to zoom in).

But how can I detect such a gesture when my API is 7 (Android 2.1) and when no GestureDetector is available?

Thanks

Elmi

PS: to clarify that: I don't want to implement my ap for later API versions only since 2.1 and 2.2 are most used versions of Android


Solution

  • actually the GestureDetector IS available in API level 7

    import android.view.GestureDetector;