android
/**
* This is class for touch event ,when user touched the screen for
* enough time, user can tag the touched place as user's favorite
* place, or fix current position and set as destination.
* @author xinyan
*@date 2011-10-10
*/
class Touchy extends Overlay {
@Override
public boolean onTouchEvent(MotionEvent e, MapView mapView) {
Log.v(TAG, "Touchy is touched...");
if (MotionEvent.ACTION_DOWN == e.getAction()) {
start = e.getEventTime();
x = (int) e.getX();
y = (int) e.getY();
touchPoint = mMapView.getProjection().fromPixels(x, y);
Log.v(TAG, "Touchy is touched.. and we get touch point.");
}
if (MotionEvent.ACTION_UP == e.getAction()) {
stop = e.getEventTime();
}
if (stop - start > 1500) {
OverlayItem overlayItem = new OverlayItem(touchPoint,
"Pined position", "A new position");
CustomPinpoint custom = new CustomPinpoint(marker,
StandardActivity.this);
custom.insertPinpoint(overlayItem);
mMapView.getOverlays().add(custom);
new AlertDialog.Builder(StandardActivity.this)
.setIcon(null)
.setTitle(R.string.whatYouWant)
.setSingleChoiceItems(
相关新闻>>
- 发表评论
-
- 最新评论 更多>>