Possible Duplicate:
Double Tap -> Zoom on Android MapView?
I am newbie Android developer. I am developing an application in which I am using GoogleMaps. I have to implement double tap zoom in GoogleMaps. When I double click on the map it should zoom in. Kindly if it is possible provide a sample code.
I have written the following code but I dont know what to add more.
public class Maps extends MapActivity implements OnGestureListener, OnDoubleTapListener {
private GestureDetector detector;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// MapViewer mapViewer = new MapViewer(null, null);
MapView mapView = (MapView) findViewById(R.id.mapview);
detector = new GestureDetector(this, this);
mapView.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
public boolean onDoubleTap(MotionEvent e) {
mapView.getController().zoomIn();
return false;
}
public boolean onDoubleTapEvent(MotionEvent e) {
return false;
}
public boolean onSingleTapConfirmed(MotionEvent e) {
return false;
}
public boolean onDown(MotionEvent e) {
return false;
}
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
return false;
}
public void onLongPress(MotionEvent e) {
}
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
return false;
}
public void onShowPress(MotionEvent e) {
}
public boolean onSingleTapUp(MotionEvent e) {
return false;
}
}