mapView show overlay details when clicked
<p>Ive been trying to acheive the same, this is exactly what i want :-
<img src="http://i.stack.imgur.com/ZxMcC.jpg" alt="Google Maps Image"></p>

<p>i have implemented googleMapView with overlays, i have one issue i want to show a popup when clicked on each overlay, and when i click on another overlay the previous popus should disappear and new one should appear at the clicked location(ie projection points). And popup shouldnt appear when i click anywhere else on screen.Im using onTap event to record onclick. (map_overlay) is the layout that i want to show when someone click a projection point on the map. The code is below and map_overlay.xml could be any file. </p>

<p><strong>Class: ItemizedOverlay</strong></p>

<pre><code>public boolean onTap(GeoPoint p, MapView mapView) {

LayoutInflater inflater = (LayoutInflater)cContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

LayoutParams lp = new MapView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, p, LayoutParams.WRAP_CONTENT);
LinearLayout view = (LinearLayout)inflater.inflate(R.layout.map_overlay, null);

mapView.removeView(view);    
mapView.invalidate();    
mapView.addView(view,lp);

mapView.invalidate();

return true;
}
</code></pre>

<p>Below is the Main class in which im displaying projection points which is working fine and im calling I have implemented the onTap event in another class as shown above:</p>

<pre><code>public **class MapView** extends MapActivity{
    private ArrayList&lt;MyClass&gt; overlayItem ;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.large_mapview);
        mapView = (MapView) findViewById(R.id.mapview);
       // mapView.setBuiltInZoomControls(true);

        List&lt;Overlay&gt; mapOverlays = mapView.getOverlays();
        Drawable drawable = this.getResources().getDrawable(R.drawable.mappointer2);
        ItemizedOverlay itemizedoverlay = new ItemizedOverlay(drawable,this);
        OverlayItem overlayitem;
        GeoPoint point;
        double lat;
        double lng;        

        for (int i = 0; i &lt; overlayItem.size(); i++) {

            lat = Double.parseDouble(overlayItem.get(i).getLatitude());
            lng = Double.parseDouble(overlayItem.get(i).getLongitude());
            point = new GeoPoint((int) (lat * 1E6),(int) (lng * 1E6));

            overlayitem = new OverlayItem(point, i+"".toString(), overlayItem.get(i).getDetails().toString());
            itemizedoverlay.addOverlay(overlayitem);
            mapOverlays.add(itemizedoverlay);

        }

        mapView.invalidate();
    }
}
</code></pre>
