I haven't used zoomToSpan(). setCenter() certainly works everywhere I've tried it, and your use does not seem unusual. Try this app:
http://github.com/commonsguy/cw-android/tree/master/Maps/NooYawk/ On Tue, Jul 13, 2010 at 7:50 PM, Bret Foreman <[email protected]> wrote: > 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? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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

