Trying to do a map example I found here
http://codemagician.wordpress.com/2010/05/06/android-google-mapview-tutorial-done-right/
The problem is this code. Specifically, the compiler does not seem to know what a MapView is? In fact, also applies to android.graphics.drawable.Drawable. I thought that the import statement would resolve that but must be missing some other setup step.
Any help appreciated.
package com.example.HelloGoogleMaps2;
import java.util.List;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
public class MainMap extends MapActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
**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, "Laissez les bon temps rouler!", "I'm in Louisiana!");
GeoPoint point2 = new GeoPoint(17385812,78480667);
OverlayItem overlayitem2 = new OverlayItem(point2, "Namashkaar!", "I'm in Hyderabad, India!");
itemizedoverlay.addOverlay(overlayitem);
itemizedoverlay.addOverlay(overlayitem2);
mapOverlays.add(itemizedoverlay);
}
@Override
protected boolean isRouteDisplayed()
{
return false;
}
}
Check your target device when you create new project. It should be
Google APIs(Google Inc.)-API Level -(whatever you want).as doc says :”you must have an
AVDconfigured to use theGoogle APIstarget, or be using a development device that includes theMaps library“.And make sure you have Internet Permissionand as MapView is not included in the default Android libraries, so you need to
specify in AndroidManifest.xml
and here is a good place to start with google maps
are you sure you have