How do you use the Android API to zoom in and out maps with the 2 finger gestures like iPhone?
You need to override the MapActivity's OnTouchEvent() with something like this:
@Override
public boolean onTouchEvent(final MotionEvent event)
{
if(event.getPointerCount() > 1)
{
int x1 = event.getX(0);
int y1 = event.getY(0);
int x2 = event.getX(1);
int y2 = event.getY(1);
// Get the distance and see how it compares to the previous
// distance between these two pointers
}
return true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With