After a little bit of work my route application works fine. The only thing I just want to add is a double tap zoom in function, but I don\'t know how.
Could you give
Use the following code when you want to zoom in and zoom out
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
long thisTime = System.currentTimeMillis();
DisplayMetrics metrics = new DisplayMetrics();
WindowManager wm = (WindowManager) activity.getSystemService(activity.getApplicationContext().WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(metrics);
int height = metrics.heightPixels;
if (thisTime - lastTouchTime < ViewConfiguration.getDoubleTapTimeout()) {
// Double tap
if((height/2)>ev.getY()){
// Zoom IN
this.getController().zoomInFixing((int) ev.getX(), (int) ev.getY());
}else{
this.getController().zoomOutFixing((int) ev.getX(), (int) ev.getY());
//Zoom Out
}
lastTouchTime = -1;
} else {
// Too slow
lastTouchTime = thisTime;
}
}
return super.onInterceptTouchEvent(ev);
}