title: Google Map View tutorial - Overlays
body: <p>I followed Google's Map View tutorial from this link <a href="http://developer.android.com/resources/tutorials/views/hello-mapview.html" rel="nofollow">http://developer.android.com/resources/tutorials/views/hello-mapview.html</a><br>
  I've done the first about Creating Map activity, but have problems with Adding Overlays. Here is the source code:</p>
  
  <pre><code>package rs.iz.stevy.wifi;
  
  import java.util.ArrayList;
  
  import android.graphics.drawable.Drawable;
  import android.app.AlertDialog;
  import android.content.Context;
  import com.google.android.maps.ItemizedOverlay;
  import com.google.android.maps.OverlayItem;
  
  public class Overlay extends ItemizedOverlay {
  
      public Overlay(Drawable defaultMarker, Context context) {
            super(defaultMarker);
            Context mContext;
            mContext = context;
          }
  
      private ArrayList&lt;OverlayItem&gt;mOverlays= new ArrayList&lt;OverlayItem&gt;();
  
      public Overlay(Drawable defaultMarker) {
          super(boundCenterBottom(defaultMarker));
      }
      public void addOverlay(OverlayItem overlay) {
          mOverlays.add(overlay);
          populate();
      }
  
      @Override
      protected OverlayItem createItem(int i) {
          return mOverlays.get(i); }
  
      @Override
      public int size() {
          return mOverlays.size();
      }
  
      @Override
      protected boolean onTap(int index) {
        OverlayItem item = mOverlays.get(index);
        AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
        dialog.setTitle(item.getTitle());
        dialog.setMessage(item.getSnippet());
        dialog.show();
        return true;
      }
  
  }
  </code></pre>
  
  <p>Error appear at this line:
    AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
  Eclipse shows mContext cannot be resolved to variable.</p>
  
  <p>Here is the Activity class:</p>
  
  <pre><code>rs.iz.stevy.wifi;
  
  import java.util.List;
  
  import com.google.android.maps.GeoPoint;
  import com.google.android.maps.ItemizedOverlay;
  import com.google.android.maps.MapActivity;
  import com.google.android.maps.MapView;
  import com.google.android.maps.Overlay;
  
  import android.graphics.drawable.Drawable;
  import android.os.Bundle;
  
  
  public class WiFiKupacicaActivity extends MapActivity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          MapView mapa= (MapView) findViewById(R.id.Mapa1);
          mapa.setBuiltInZoomControls(true);
          mapa.setSatellite(true);
  
         GeoPoint initGeoPoint = mapa.getMapCenter();
  
      List&lt;Overlay&gt; mapOverlays = mapa.getOverlays();
      Drawable drawable = this.getResources().getDrawable(R.drawable.kupacica);
      Overlay itemizedoverlay = new Overlay (drawable);
  
      }
  
      @Override
      protected boolean isRouteDisplayed() {
          // TODO Auto-generated method stub
          return false;
      }
  </code></pre>
  
  <p>Eclipse show error Cannot instantiate Overlay at this line:
          Overlay itemizedoverlay = new Overlay (drawable);</p>
  
  <p>If you see here any error that can be easily fixed please answer cause this are my first attempts to write an android app.</p>