how to show user name and its status on the map by clicking
<p>I am trying to fetch data of the user on the particular social network. it displays the users who are registered user of that site. I want to show the User name and show its status by clicking on that user on the map.
here showing the code as below: </p>

<pre><code>MyMapViewActivity.java


import java.util.ArrayList;
import java.util.List;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class MyMapViewActivity extends MapActivity {
    FriendsBean fBean;
    double lat;
    double longi;
    MapView mapview;
    String strUrl;
    XmlParser parser;
    ArrayList&lt;Object&gt; result;
    List mapOverlays;
    GeoPoint gp;
    OverlayItem overlayitem;
    Drawable drawable;
    HelloItemizedOverlay itemizedoverlay;
    @Override
    @SuppressWarnings("unchecked")
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mapviewactivity);
        mapview = (MapView) findViewById(R.id.mapView);
        mapview.setBuiltInZoomControls(true);
        mapOverlays = mapview.getOverlays();
        strUrl = "http://192.168.5.10/ijoomer_development/index.php?option=com_ijoomer&amp;plg_name=jomsocial&amp;pview=friend&amp;ptask=all_friend_paging&amp;userid="+ConstantData.user_id+"&amp;pageno="+ 5 +"&amp;limit=5&amp;sessionid="+ ConstantData.session_id +"@&amp;tmpl=component";
        parser = new XmlParser(strUrl, new FriendsBean());
        result = parser.ParseUrl("data","member");
        for(int i=0; i&lt;result.size(); i++)
        {
        fBean = (FriendsBean)result.get(i); 
        drawable = this.getResources().getDrawable(R.drawable.friend);
        itemizedoverlay = new HelloItemizedOverlay(drawable);
        lat = Double.parseDouble(fBean.latitude) ;
        longi = Double.parseDouble(fBean.longitude);
        gp = new GeoPoint((int)(lat * 1E6), (int)(longi * 1E6));
        mapview.getController().setCenter(gp);
        mapview.getController().setZoom(17);
        drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
                drawable.getIntrinsicHeight()); 
        overlayitem = new OverlayItem(gp, fBean.name,fBean.status);
        itemizedoverlay.addOverlay(overlayitem);
        mapOverlays.add(itemizedoverlay);
        }

    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

    public boolean onKeyDown(int keyCode, KeyEvent event) 
    {
    MapController mc = mapview.getController(); 
    switch (keyCode) 
    {
    case KeyEvent.KEYCODE_3:
    mc.zoomIn();
    break;
    case KeyEvent.KEYCODE_1:
    mc.zoomOut();
    break;
    }
    return super.onKeyDown(keyCode, event);
    }

}
</code></pre>

<p>HelloItemizedOverlay.java</p>

<pre><code>import java.util.ArrayList;
import java.util.List;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class HelloItemizedOverlay extends ItemizedOverlay {
    FriendsBean fBean;
    double lat;
    double longi;
    private List items = new ArrayList();
    private static Drawable marker = null;
    GeoPoint gp;

    //private ArrayList&lt;OverlayItem&gt; mOverlays = new ArrayList&lt;OverlayItem&gt;();
    Context mContext;
    MyMapViewActivity mviewacti = new MyMapViewActivity(); 

    public HelloItemizedOverlay(Drawable defaultMarker) {
        super(marker);
        this.marker= marker;
        lat = Double.parseDouble(fBean.latitude) ;
        longi = Double.parseDouble(fBean.longitude);
        items.add(new OverlayItem(getPoint
                ((int)(lat * 1E6), (int)(longi * 1E6)),
                    fBean.name, fBean.status));
</code></pre>

<p>}
private GeoPoint getPoint(double d, double e) {
            // TODO Auto-generated method stub
            return null;
}
public HelloItemizedOverlay(Drawable defaultMarker, Context context) {
            super(defaultMarker);
            mContext = context;
        }</p>

<pre><code>    public void addOverlay(OverlayItem overlay) {
        mOverlays.add(overlay);
        populate();
    }

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

    @Override
    protected boolean onTap(int index)
    {   Log.i("OnTap", ""+index);
        Toast.makeText(mContext, "you are here"+index , Toast.LENGTH_SHORT ).show();
        return true;
    }
    @Override
    public int size() {
        return mOverlays.size();
    }
</code></pre>

<p>}</p>
