1

I have an application which requires plotting two locations on google map ? One of these location will be my current location and second location is my friend's location which I have obtained.Now my problem is I'm abled to plot my friend's location on map but not abled to plot my location on same map.Can anyone tell me how to plot my location and my friend's location on same map ?

dark_shadow
  • 3,503
  • 11
  • 56
  • 81

1 Answers1

9

Check this link :

http://eagle.phys.utk.edu/guidry/android/mapOverlayDemo.html

This code may help you :

     MapView mapView = (MapView) findViewById(R.id.mapview);
     mapView.setBuiltInZoomControls(true);

 List<Overlay> mapOverlays = mapView.getOverlays();
 Drawable drawable = this.getResources().getDrawable(R.drawable.icon);
 HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable,this);
 GeoPoint point = new GeoPoint(30443769,-91158458);
 OverlayItem overlayitem = new OverlayItem(point, "Hi!", "Second!");

 GeoPoint point2 = new GeoPoint(17385812,78480667);
 OverlayItem overlayitem2 = new OverlayItem(point2, "Hello!", " fisrt one!");

 itemizedoverlay.addOverlay(overlayitem);
 itemizedoverlay.addOverlay(overlayitem2);

 mapOverlays.add(itemizedoverlay);
Nibha Jain
  • 7,742
  • 11
  • 47
  • 71