Note that there are some explanatory texts on larger screens.

plurals
  1. POadding multiple marker on google map in android
    primarykey
    data
    text
    <p>I am triyng to add multiple marker on google map. Here is my code section</p> <pre><code>public class GoogleMap extends MapView { MapController mc; MapView mapView; GeoPoint p; @Override public void onCreate(Bundle savedInstanceState) { .... double lat = Double.parseDouble(bundle.getString("paramLat")); double lng = Double.parseDouble(bundle.getString("paramLong")); mc = mapView.getController(); p = new GeoPoint( (int) (lat * 1E6), (int) (lng * 1E6)); mc.animateTo(p); mc.setZoom(17); //---Add a location marker--- MapOverlay mapOverlay = new MapOverlay(); List&lt;Overlay&gt; listOfOverlays = mapView.getOverlays(); listOfOverlays.clear(); listOfOverlays.add(mapOverlay); mapView.invalidate(); } class MapOverlay extends com.google.android.maps.Overlay { @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { super.draw(canvas, mapView, shadow); //---translate the GeoPoint to screen pixels--- Point screenPts = new Point(); mapView.getProjection().toPixels(p, screenPts); //---add the marker--- Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pushpin); canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null); return true; } } </code></pre> <p>I have two question here. When i tried to add only one marker, it works but draw method is invoked many times. But why? and when is it invoked? </p> <p>The second question is how can i add new marker. I created second geoPoint named p2 and after that what should i do? Thank you very much.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload