1

I want to draw a polygon on the map view. It is like, i have a n number of GeoPoints and then using those geopoints, i want to draw a polygon with n vertices.

thanks!!

Update:

thanks to freza, now i know how to draw a overlay.

There is an another function under overlay class : public boolean onTap(GeoPoint p, MapView mapView). Now what i want is when user tap on any overlay, i want to change the image of the overlay.

For example, initially i have drawn a simple green circle for displaying overlay. So now when user taps on that green overlay: i want to change the color to red or draw a new bitmap in place if green circle. How can i do this?

mudit
  • 25,306
  • 32
  • 90
  • 132

1 Answers1

0

This can help you. code follows:

          private void changeMarkers(int noteIndex) {
    for (int i = 0; i < noteOverlays.size(); i++) {
        if (i == noteIndex || noteIndex == -1) {
            Drawable selectedMarker = getResources().getDrawable(
                    R.drawable.note_in_map);
            int selectedMarkerWidth = selectedMarker.getIntrinsicWidth();
            int selectedMarkerHeight = selectedMarker.getIntrinsicHeight();
            selectedMarker.setBounds(-selectedMarkerWidth / 2,
                    -selectedMarkerHeight, selectedMarkerWidth / 2, 0);         noteOverlays.getItem(i).setMarker(selectedMarker);
        } else {
            Drawable unselectedMarker = getResources().getDrawable(
                    R.drawable.note_in_map_notselected);
            int nonSelectedMarkerWidth = unselectedMarker
                    .getIntrinsicWidth();
            int nonSelectedMarkerHeight = unselectedMarker
                    .getIntrinsicHeight();
            unselectedMarker
                    .setBounds(-nonSelectedMarkerWidth / 2,
                            -nonSelectedMarkerHeight,
                            nonSelectedMarkerWidth / 2, 0);
            noteOverlays.getItem(i).setMarker(unselectedMarker);
        }
    }
    mapView.invalidate();
}
Sharmilee
  • 1,286
  • 1
  • 12
  • 20