Double tap: zoom on Android MapView?

I’ve also been searching for an answer/example, but found nowhere working code. Finally, here’s the code that’s working for me: MyMapActivity.java public class MyMapActivity extends MapActivity implements OnGestureListener, OnDoubleTapListener { private MapView mapView; @Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.main); mapView = (MapView)findViewById(R.id.mapView); } @Override public boolean onDoubleTap(MotionEvent e) { int x = … Read more

Can we use scale gesture detector for pinch zoom in Android?

You can use this import android.content.Context; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; public class MyImageView extends View { private static final int INVALID_POINTER_ID = -1; private Drawable mImage; private float mPosX; private float mPosY; private float mLastTouchX; private float mLastTouchY; private int mActivePointerId = INVALID_POINTER_ID; private ScaleGestureDetector … Read more

Android: Difference between onInterceptTouchEvent and dispatchTouchEvent?

The best place to demystify this is the source code. The docs are woefully inadequate about explaining this. dispatchTouchEvent is actually defined on Activity, View and ViewGroup. Think of it as a controller which decides how to route the touch events. For example, the simplest case is that of View.dispatchTouchEvent which will route the touch … Read more