title: how to show marker detail on marker click in android osm?
body: <p>I am new to use osm in android.I have successfully show OSM in android.But i have no idea " <strong>how to click on marker and show marker detail like google map v2 infowindow popup</strong>".</p>
  
  <p><strong>How to show marker details with image onclick marker openstreetmap android, same as Google map Infowindow show on marker click.</strong></p>
  
  <p>Please give me code or idea to implement marker click event in osm android.</p>
  
  <p>Thank you in advance.</p>
  
  <p>This is my code which i have implemented in android java</p>
  
  <pre><code>public class MainActivity extends Activity 
  {
  private MapView mapView;
  private MapController mapController;    
  LocationManager locationManager;
  
  ArrayList&lt;OverlayItem&gt; overlayItemArray;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) 
  {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mapView = (MapView)findViewById(R.id.mapview);
  
  mapView.setBuiltInZoomControls(true);
  mapView.setMultiTouchControls(true);
  mapView.setClickable(true);
  //mapView.setUseDataConnection(false);
  mapController = (MapController) mapView.getController();
  mapController.setZoom(17);
  
  //--- Create Overlay
  overlayItemArray = new ArrayList&lt;OverlayItem&gt;();
  
  DefaultResourceProxyImpl defaultResourceProxyImpl = new DefaultResourceProxyImpl(this);
  MyItemizedIconOverlay myItemizedIconOverlay = new MyItemizedIconOverlay(overlayItemArray, null, defaultResourceProxyImpl);
  mapView.getOverlays().add(myItemizedIconOverlay);
  //---
  
  locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
  
  //for demo, getLastKnownLocation from GPS only, not from NETWORK
  Location lastLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
  if(lastLocation != null)
  {
      updateLoc(lastLocation);
  }
  
  //Add Scale Bar
  ScaleBarOverlay myScaleBarOverlay = new ScaleBarOverlay(this);
  mapView.getOverlays().add(myScaleBarOverlay);
  }
  
  @Override
  protected void onResume()
  {
  super.onResume();
  locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, myLocationListener);
  locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, myLocationListener);
  }
  
  @Override
  protected void onPause() 
  {
  super.onPause();
  locationManager.removeUpdates(myLocationListener);
  }
  
  private void updateLoc(Location loc)
  {
  GeoPoint locGeoPoint = new GeoPoint(loc.getLatitude(), loc.getLongitude());
  mapController.setCenter(locGeoPoint);
  mapController.animateTo(locGeoPoint);
  
  setOverlayLoc(loc);
  
  mapView.invalidate();
  }
  
  private void setOverlayLoc(Location overlayloc)
  {
  GeoPoint overlocGeoPoint = new GeoPoint(overlayloc);
  //---
  overlayItemArray.clear();
  
  OverlayItem newMyLocationItem = new OverlayItem("My Location", "My Location", overlocGeoPoint);
  overlayItemArray.add(newMyLocationItem);
  //---
  }
  
  private LocationListener myLocationListener = new LocationListener()
  {
  @Override
  public void onLocationChanged(Location location)
  {
      updateLoc(location);
  }
  
  @Override
  public void onProviderDisabled(String provider)
  {           
  }
  
  @Override
  public void onProviderEnabled(String provider)
  {           
  }
  
  @Override
  public void onStatusChanged(String provider, int status, Bundle extras)
  {           
  }
  };
  
  private class MyItemizedIconOverlay extends ItemizedIconOverlay&lt;OverlayItem&gt;
  {
  
  public MyItemizedIconOverlay(List&lt;OverlayItem&gt; pList,org.osmdroid.views.overlay.ItemizedIconOverlay.OnItemGestureListener&lt;OverlayItem&gt; pOnItemGestureListener,
          ResourceProxy pResourceProxy)
  {
      super(pList, pOnItemGestureListener, pResourceProxy);           
  }
  
  @Override
  public void draw(Canvas canvas, MapView mapview, boolean arg2)
  {
      super.draw(canvas, mapview, arg2);
  
      if(!overlayItemArray.isEmpty())
      {
          //overlayItemArray have only ONE element only, so I hard code to get(0)
          GeoPoint in = overlayItemArray.get(0).getPoint();
  
          Point out = new Point();
          mapview.getProjection().toPixels(in, out);
  
          Bitmap bm = BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher);
          canvas.drawBitmap(bm,out.x - bm.getWidth()/2,out.y - bm.getHeight()/2,null);
      }
  }
  
  @Override
  public boolean onSingleTapUp(MotionEvent event, MapView mapView)
  {
      //return super.onSingleTapUp(event, mapView);
      return true;
  }
  
  @Override
  public boolean onSingleTapConfirmed(MotionEvent event, MapView mapView)
  {
      return true;
  }
  }
  }
  </code></pre>
  
  <p>activity_main.xm</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" &gt;
  
  &lt;org.osmdroid.views.MapView
      android:id="@+id/mapview"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
  &lt;/org.osmdroid.views.MapView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>