title: Mark name of location on map?
body: <p>In my Android app I want to mark on map a location (I know the address of location). When I mark it on map, I want to display the name of location,too. How can I do that?</p>
  
  <p>I have this: OverlayItem(p ,"Kaufland", "Magic Kingdom"),but on map appear only the point,without the name.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>package com.ShoppingList.Shops;
  
  
  import java.io.IOException;
  import java.util.List;
  import java.util.Locale;
  
  import com.ShoppingList.R;
  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 java.util.ArrayList;
  import android.graphics.Canvas;
  import android.graphics.drawable.Drawable;
  import android.location.Address;
  import android.location.Geocoder;
  import android.os.Bundle;
  import com.google.android.maps.ItemizedOverlay;
  import com.google.android.maps.OverlayItem;
  
  public class ShowMap extends MapActivity {
      private MapView mapView;
      MapController mc;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.showmap);
  
          mapView = (MapView) findViewById(R.id.mapview);
          mapView.setBuiltInZoomControls(true);
          mapView.setClickable(true);
  
          Drawable marker=getResources().getDrawable(R.drawable.pushpin);
          marker.setBounds(0, 0, marker.getIntrinsicWidth(),
          marker.getIntrinsicHeight());
  
          InterestingLocations funPlaces = new InterestingLocations(marker);
          mapView.getOverlays().add(funPlaces);
          GeoPoint pt = funPlaces.getCenter(); // get the first-ranked point
          mapView.getController().setCenter(pt);
          mapView.getController().setZoom(15);
  
      }
      @Override
      protected boolean isLocationDisplayed() {
      return false;
      }
      @Override
      protected boolean isRouteDisplayed() {
      return false;
      }
      class InterestingLocations extends ItemizedOverlay {
          private List locations = new ArrayList();
          private Drawable marker;
          String adresa;
          public InterestingLocations(Drawable marker)
          {
          super(marker);
          this.marker=marker;
          // create locations of interest
          Bundle bundle = getIntent().getExtras();
          adresa = bundle.getString("adress");
  
          Geocoder geoCoder = new Geocoder(ShowMap.this, Locale.getDefault());
          try {
          List addresses = geoCoder.getFromLocationName(adresa, 5);
              String add = "";
              if (addresses.size() > 0) {
                  GeoPoint p = new GeoPoint((int) (addresses.get(0).getLatitude() * 1E6), 
                          (int) (addresses.get(0).getLongitude() * 1E6));
  
                  locations.add(new OverlayItem(p ,"Kaufland", "Magic Kingdom"));
  
              }
          } catch (IOException e) {
              e.printStackTrace();
          }
          populate();
      }
      @Override
      public void draw(Canvas canvas, MapView mapView, boolean shadow) {
      super.draw(canvas, mapView, shadow);
      boundCenterBottom(marker);
      }
      @Override
      protected OverlayItem createItem(int i) {
      return locations.get(i);
      }
      @Override
      public int size() {
      return locations.size();
      }
      }
  }</code></pre>