How can I drag a marker on the map? How to handle it in onTouchEvent()?
I had written one code that actually drags. But it feels like the map is moving instead of the marker. That code is written below:
public boolean onTouchEvent(MotionEvent event, MapView mapView) { /*Action to be taken on ACTION_UP(value=1) and ACTION_DOWN(value=0)*/ if(event.getAction() == 0 || event.getAction() == 1){ mapView.displayZoomControls(true); } /*Action to be taken on ACTION_MOVE(value=2)*/ if(event.getAction() == 2){ for(int i = 0; i < mOverlays.size() ; i++){ mOverlays.remove(i); } GeoPoint point = mapView.getProjection().fromPixels((int) event.getX(),(int) event.getY()); OverlayItem overlayItem = new OverlayItem(point, "", ""); addOverlay(overlayItem); mapView.getController().setCenter(point); } return true; } Is there any solution for this?