开发者

how to show multi color map overlays or pins in android on google map?

friends,

right now i am showing list of map overlays on google map using following code

 mapOverlays = mapView.getOverlays();
        drawable = this.getResources().getDrawable(R.drawable.balloon);
        itemizedOv开发者_如何学Goerlay = new MarkerItemizedOverlay(drawable,this);

        GeoPoint point;
        OverlayItem overlayitem;
         for (DalMapSearch t : Sr)
         {
             if(t != null)
             {
            point = new GeoPoint((int) (t.getLati() * 1E6),  (int) (t.getLongi() * 1E6));
             overlayitem = new OverlayItem(point, heading, t.getAd_text()+", "+t.getLocation()+"@@"+t.getAd_id());
            itemizedOverlay.addOverlay(overlayitem);
             }

         }
         mapOverlays.add(itemizedOverlay);


        // marker code goes here

        mc.animateTo(myLocation);

        mc.setZoom(12); 
        mapView.invalidate();

so in such a scenario balloon is displayed i want to show other images too depened upon category or a if statement. any one guide me how can i show different images as a map overlay? for example images are imageA,ImageB,ImageC

any help would be appreciated.


GeoPoint point = new GeoPoint(lat.intValue(), lng.intValue());

    drawable = this.getResources().getDrawable(R.drawable.marker);
    itemizedOverlay = new MyItemizedOverlay(drawable);
    OverlayItem overlayItem = new OverlayItem(point, "", "");
    itemizedOverlay.addOverlay(overlayItem);
    mapOverlays.add(itemizedOverlay);


    GeoPoint point2 = new GeoPoint(lt2.intValue(),long2.intValue() );
    // All "B"s
    drawable = this.getResources().getDrawable(R.drawable.icon);
    itemizedOverlay = new MyItemizedOverlay(drawable);
    OverlayItem overlayItem1 = new OverlayItem(point2, "", "");
    itemizedOverlay.addOverlay(overlayItem1);
    mapOverlays.add(itemizedOverlay);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜