I think I'm getting there, but it seems like my projection isn't
working. This is my onCreate-method in my MapActivity:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
_mapView = (MapView)findViewById(R.id.mapView);
_mapView.setBuiltInZoomControls(true);
_mapController = _mapView.getController();
double lat = 35.908138*1E6;
double lng = 14.500975*1E6;
_gp = new GeoPoint((int)lat,(int)lng);
Point p = _mapView.getProjection().toPixels(_gp, null);
// Add overlay
_moodOverlay = new MoodOverlay();
List<Overlay> overlays = _mapView.getOverlays();
overlays.add(_moodOverlay);
_mapController.animateTo(_gp);
_mapController.setZoom(17);
System.out.println("GeoPoint: " + _gp.getLatitudeE6() + "x" +
_gp.getLongitudeE6());
System.out.println("Center of screen: " + p.x + "x" + p.y);
}
The problem is that the toPixels is totally wrong. It print's the
following:
GeoPoint: 35908138x14500975
Center of screen: -344668x21990
What is wrong here?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en