Using ItemizedOverlay and OverlayItem In Android Beta 0.9

For the sake of completeness I’ll repeat the discussion on Reto’s post over at the Android Groups here.

It seems that if you set the bounds on your drawable it does the trick:

Drawable defaultMarker = r.getDrawable(R.drawable.icon);

// You HAVE to specify the bounds! It seems like the markers are drawn
// through Drawable.draw(Canvas) and therefore must have its bounds set
// before drawing.
defaultMarker.setBounds(0, 0, defaultMarker.getIntrinsicWidth(),
    defaultMarker.getIntrinsicHeight());

MyItemizedOverlay markers = new MyItemizedOverlay(defaultMarker);
overlays.add(markers);

By the way, the above is shamelessly ripped from the demo at MarcelP.info. Also, here is a good howto.

Leave a Comment

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.