0

クラス Overlay とそのクラスからメソッド onTap を呼び出すことで、マップ全体にドローアブルを表示できます。私がやりたいことは、ユーザーがマップをタップしたときに1つのドローアブルを表示するだけで(最初のタップ)、タップして別の場所に何度もドローアブルを表示しないことです。これは可能ですか?

4

1 に答える 1

0
override you onTap() method of Overlay

    @Override
    protected boolean onTap(int index) {
         Drawable srcdrawable = getApplicationContext().getResources().getDrawable(R.drawable.pin_blue);
    CustomItemizedOverlay srcitemizedOverlay = new CustomItemizedOverlay(srcdrawable, getApplicationContext());
    forloop(setoflocations){
    GeoPoint srcpoint = new GeoPoint((int)( Double.parseDouble(lat) * 1E6),(int)( //latitude and longitude of user tapped location...
Double.parseDouble(lng)* 1E6));
    OverlayItem srcoverlayitem = new OverlayItem(srcpoint, "Hello!", "This is your Location.");
    if(srcitemizedOverlay!=null && mapController!=null){
    srcitemizedOverlay.addOverlay(overlayitem);
    mapController.animateTo(point);
    animatePoint = point;
    }
    }
    mapView.getOverlays().clear();
    mapView.getOverlays().add(srcitemizedOverlay);

   // pop up a alert dialog here and ask user for confirmation

    }
于 2013-01-23T10:22:35.327 に答える