I'm having some trouble with this method. It doesn't seem to center
the map at the correct place. Here's my code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.eventmapview );
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
MapController myController = mapView.getController();
int myLat = (int) (1e6 *
getIntent().getDoubleExtra("com.android.shipmate.lat",0.0));
int myLon = (int) (1e6 *
getIntent().getDoubleExtra("com.android.shipmate.lon",0.0));
android.util.Log.d( getString(R.string.app_name) , "Setting
center to lat=" + myLat + " lon=" + myLon );
GeoPoint centerPoint = new GeoPoint( myLat , myLon );
myController.setCenter(centerPoint);
myController.zoomToSpan(100000, 100000);
}
Inspecting in the debugger, the value of myLat = 37,062,500 and myLon
= -95,677,706, which should be centered on San Francisco. But instead,
the map remains centered on Kansas, which I think is the default.
I got the geo locations for testing purposes by going to
maps.google.com and entering San Francisco, then generating a string
intended for emailing, then picking the lat/lon values from that
string. As far as I know, the GeoPoint passed to setCenter is just
those values multiplied by 1e6.
Any ideas why it's not working?
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en