I am stuck with this, I have tried every possibility but not success. I have create simple application with map for testing and user can simple touch on map and on that place put the marker. This will work successfully in all device except in htc devices. I don't know how to implement onTouch event for mapview
here is my code for onTouch
private class MarkerOverlay extends Overlay{
private boolean isMove;
@Override
public boolean onTouchEvent(MotionEvent e, MapView mapView) {
final int x = (int) e.getX();
final int y = (int) e.getY();
if(e.getAction()==1){
if(!isMove){
geopoint = mapView.getProjection().fromPixels(x, y);
OverlayItem overlayItem = new OverlayItem(geopoint, "Title", "Description");
if(mapOverlay.m_overlays.size()>=1){
mapOverlay.clearOverlayAll();
}
mapOverlay.addOverlay(overlayItem);
if(!mapView.getOverlays().contains(mapOverlay))
mapView.getOverlays().add(mapOverlay);
mapView.invalidate();
Toast.makeText(SimpleMapMarkerActivity.this, "in press", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(SimpleMapMarkerActivity.this, "out press", Toast.LENGTH_SHORT).show();
}
}else if(e.getAction()==MotionEvent.ACTION_DOWN)
isMove = false;
else if(e.getAction()==MotionEvent.ACTION_MOVE)
isMove = true;
return super.onTouchEvent(e, mapView);
}
}