Hi,
I have created a map to a location following this tutorial Here
But no matter what I do I cannot add the push pin, when I get to here "To add a marker to the map, you first need to define a class that extends the Overlay class:"
I get stuck, I have tried to add a MapOverlay following the HelloGoogleMaps tutorial on android developers to add the overlay but I get errors all over the place, can anyone point in the right direction or suggest a tutrorial or provide a link to source code that might help, my code is below;
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 com.google.android.maps.MapView.LayoutParams;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
public class GoogleMaps extends MapActivity
{
MapView mapView;
MapController mc;
GeoPoint p;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapView);
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
View zoomView = mapView.getZoomControls();
zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mapView.displayZoomControls(true);
mc = mapView.getController();
String coordinates[] = {" 53.804224", "-1.759057"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
p = new GeoPoint(
(int) (lat * 1E6),
(int) (lng * 1E6));
mc.animateTo(p);
mc.setZoom(17);
mapView.invalidate();
mapView.setSatellite(true);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
At this point when I try to add a mapoverlay as in the HelloGoogleMaps tutorial it either crashes or I get errors.
Thanks in advance