How to display mulitple markers at a time in google map in android
<p>Hi iam displaying mulitple markers in google map in android.while iam displaying, the markers are displaying in the google map one by one.Here i want to display more than 50 markers.But according to my code the markers are displaying one by one and to display 50 markers it is taking so much time.Below is my code which is in the same class.Any idea is appreciated.</p>

<p>public void displayMarkersOnMap(){</p>

<pre><code> Runnable r=new Runnable(){

     public void run(){
</code></pre>

<p>for (int i = 0; i &lt; vector.size(); i++) {</p>

<pre><code>          try {
            pinHM = (HashMap&lt;String, Object&gt;)vector.get(i);
              mapView = (MapView)findViewById(R.id.mapView);
                mapView.getController().setZoom(9);
                  Drawable marker;          
            else{
                  String status = pinHM.get("status").toString();
               if (status.equals("ST_COMPLETE")) {
                   marker = getResources().getDrawable(R.drawable.pin_green);
              }else if (status.equals("ST_IN_PROGRESS")) {
                   marker = getResources().getDrawable(R.drawable.pin_orange);
              }else {
                   marker = getResources().getDrawable(R.drawable.pin_gray);
               }
             }
                   marker.setBounds((int) (-marker.getIntrinsicWidth() / 2),-marker.getIntrinsicHeight(),(int) (marker.getIntrinsicWidth() / 2), 0);
                   double latitude=Double.parseDouble(pinHM.get("latitude").toString());
                   double longitude=Double.parseDouble(pinHM.get("longitude").toString());
                   Geocoder geoCoder = new Geocoder(BaseMapActivity.this, Locale.getDefault());
                   List&lt;Address&gt; addresses = geoCoder.getFromLocationName(address,5);
                   if (addresses.size() &gt; 0) {
                   GeoPoint point = new GeoPoint((int)(latitude*1E6),(int)(longitude*1E6));
                   funPlaces = new MyItemizedOverlay(point,marker,hmtostring,nameaddress,mapView);
                   mapView.getOverlays().add(funPlaces);
                   GeoPoint pt = funPlaces.getCenterPt();       
                   int latSpan = funPlaces.getLatSpanE6();
                   int lonSpan = funPlaces.getLonSpanE6();
                   Log.v("Overlays", "Lat span is " + latSpan);
                   Log.v("Overlays", "Lon span is " + lonSpan);
                   MapController mc = mapView.getController();
                   mc.setCenter(pt);
            }


    } catch (IOException e) {
        e.printStackTrace();
    }       
}
        }//end of run
    };//end of Runnable
    Thread thread = new Thread(r, "BaseMapActiviy");
    thread.start();
}
</code></pre>

<p>public class MyItemizedOverlay extends BalloonItemizedOverlay {</p>

<pre><code>    private ArrayList&lt;OverlayItem&gt; m_overlays = new ArrayList&lt;OverlayItem&gt;();
    @SuppressWarnings("unused")
    private Context c;
    private GeoPoint center = null;

    public MyItemizedOverlay(GeoPoint point, Drawable marker,String hmtostring,String nameaddress,MapView mapView) {
        super(boundCenter(marker), mapView);
        c = mapView.getContext();
        m_overlays.add(new OverlayItem(point,hmtostring,nameaddress));
        populate();
    }

    public GeoPoint getCenterPt() {
        if (center == null) {
            int northEdge = -90000000;
            int southEdge = 90000000;
            int eastEdge = -180000000;
            int westEdge = 180000000;
            Iterator&lt;OverlayItem&gt; iter = m_overlays.iterator();
            while (iter.hasNext()) {
                GeoPoint pt = iter.next().getPoint();
                if (pt.getLatitudeE6() &gt; northEdge)
                    northEdge = pt.getLatitudeE6();
                if (pt.getLatitudeE6() &lt; southEdge)
                    southEdge = pt.getLatitudeE6();
                if (pt.getLongitudeE6() &gt; eastEdge)
                    eastEdge = pt.getLongitudeE6();
                if (pt.getLongitudeE6() &lt; westEdge)
                    westEdge = pt.getLongitudeE6();
            }
            center = new GeoPoint((int) ((northEdge + southEdge) / 2),
                    (int) ((westEdge + eastEdge) / 2));
        }
        return center;
    }

    @Override
    public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
      if (!shadow) {
        super.draw(canvas, mapView, shadow);
      }
      return false;
    }

    public void addOverlay(OverlayItem overlay) {
        m_overlays.add(overlay);
        populate();
    }

    @Override
    protected OverlayItem createItem(int i) {
        return m_overlays.get(i);
    }

    @Override
    public int size() {
        return m_overlays.size();
    }

    @Override
    protected boolean onBalloonTap(int index) {
        return true;
    }       
}
</code></pre>
