[android-developers] Re: Draw Bitmap on Overlay
Hi,
u try like this..
Point p = new Point();
_mapView.getProjection().toPixels(_gp, p);
Then, in canvas.drawBitmap(), try like this...
canvas.drawBitmap(bmp, p.x, p.y, null);
Thanks
Nithin
On Nov 18, 6:50 pm, Søren <sorni...@fooz.dk> wrote:
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home