Код: Выделить всё
public boolean onTouchEvent(MotionEvent event, MapView mapView) {
if (event.getEventTime()-event.getDownTime()>1000) { ...}
Код: Выделить всё
public boolean onTouchEvent(MotionEvent event, MapView mapView) {
if (event.getEventTime()-event.getDownTime()>1000) { ...}
Код: Выделить всё
import org.osmdroid.api.IGeoPoint;
import org.osmdroid.views.MapView;
import android.content.Context;
import android.graphics.Canvas;
import android.view.MotionEvent;
import android.widget.Toast;
class ClickHandlerOverlay extends org.osmdroid.views.overlay.Overlay {
private MapActivity mapActivity;
public ClickHandlerOverlay(MapActivity mapActivity) {
super(mapActivity);
this.mapActivity=mapActivity;
// TODO Auto-generated constructor stub
}
@Override
protected void draw(Canvas arg0, MapView arg1, boolean arg2) {
// TODO Auto-generated method stub
}
public boolean onLongPress(final MotionEvent event, final MapView mapView) {
IGeoPoint p = mapView.getProjection().fromPixels((int) event.getX(), (int) event.getY());
Toast.makeText(mapActivity, p.getLatitudeE6() / 1E6 + "," + p.getLongitudeE6() /1E6 ,Toast.LENGTH_SHORT).show();
return true;
}
}
* This class implements a form of Gesture Handling similar to
* {@link android.view.GestureDetector.SimpleOnGestureListener} and
* {@link GestureDetector.OnGestureListener}. The difference is there is an additional argument for
* the item.
Код: Выделить всё
public class MainActivity extends MapActivity {
MapView mapView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.postInvalidate();
}
}