--- android/TrainInfo/src/dk/thoerup/traininfo/stationmap/StationMapView.java 2009/10/29 13:42:57 488 +++ android/TrainInfo/src/dk/thoerup/traininfo/stationmap/StationMapView.java 2009/10/29 14:20:16 489 @@ -5,7 +5,6 @@ import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.util.Log; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; @@ -22,6 +21,7 @@ MapController mapController; MyLocationOverlay myLocation; + @SuppressWarnings("unchecked") @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -34,15 +34,9 @@ mapController = mapView.getController(); mapController.setZoom(12); - - - + Intent launchedBy = getIntent(); - - GeoPair userLocation = (GeoPair) launchedBy.getSerializableExtra("userlocation"); - Log.i("MapView", "" + userLocation.getLatitude() + "," + userLocation.getLongitude()); - mapController.setCenter( userLocation.toGeopoint() ); - + Drawable defaultIcon = getResources().getDrawable(R.drawable.train_24); StationOverlay stationOverlay = new StationOverlay(defaultIcon, this); @@ -54,6 +48,13 @@ myLocation = new MyLocationOverlay(this,mapView); + myLocation.runOnFirstFix( new Runnable() { + @Override + public void run() { + mapController.setCenter( myLocation.getMyLocation() ); + } + }); + overlays.add( myLocation ); }