DoubleTap() Zoom in problem

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

DoubleTap() Zoom in problem

Postby Xeshan » Thu Jul 08, 2010 9:58 am

Hello Friends,

I am trying to implement onDoubleTap() for zoom in google map. I want that when i double click on a google map it should zoom in. I have written some code but now i am struck. I need your help. I am sharing my code here please point out my mistake and let me know what to do. I am working on emulator but later on i will work on a real device.

Thanks in advance.

Code: Select all
package android.MapExercise;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import android.os.Bundle;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.GestureDetector.OnDoubleTapListener;
import android.view.GestureDetector.OnGestureListener;

public class MapExercise extends MapActivity implements OnGestureListener, OnDoubleTapListener {
   
    private GestureDetector detector;
    MapView mapView;   
   
                 @Override
                  public void onCreate(Bundle savedInstanceState) {
                                   super.onCreate(savedInstanceState);
                                   setContentView(R.layout.main);
       
                                   mapView = (MapView) findViewById(R.id.mapview);
                                   detector = new GestureDetector(this,this);
                                   mapView.setBuiltInZoomControls(true);
                  }
   
                 @Override
                 public boolean onTouchEvent(MotionEvent event){
                         this.detector.onTouchEvent(event);
                         return super.onTouchEvent(event);
                 }

   @Override
   public boolean onDown(MotionEvent e) {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
         float velocityY) {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public void onLongPress(MotionEvent e) {
      // TODO Auto-generated method stub
      
   }

   @Override
   public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
         float distanceY) {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public void onShowPress(MotionEvent e) {
      // TODO Auto-generated method stub
      
   }

   @Override
   public boolean onSingleTapUp(MotionEvent e) {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public boolean onDoubleTap(MotionEvent e) {
      // TODO Auto-generated method stub
      mapView.getController().zoomIn();
      return false;
   }

   @Override
   public boolean onDoubleTapEvent(MotionEvent e) {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public boolean onSingleTapConfirmed(MotionEvent e) {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   protected boolean isRouteDisplayed() {
      // TODO Auto-generated method stub
      return false;
   }
}
Xeshan
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Jul 08, 2010 9:42 am

Top

Re: DoubleTap() Zoom in problem

Postby nicholas.hauschild » Sat Jul 17, 2010 9:51 pm

So, does your app just bomb with an exception? Or does it just not do anything?
nicholas.hauschild
Master Developer
Master Developer
 
Posts: 310
Joined: Fri Dec 04, 2009 4:50 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 2 guests