Hey there,

Try using OverlayItem instead of MyOverlayItem. The member float[]
color is not used for anything in MyOverlayItem in that sample.

I have been messing around with Drawables on the OverlayItems and have
found out that you have to set the bounds of the drawables before they
show up.

Like so:

marker.Bounds = new Rect(0,0, <width>, <height>);

where <width> and <height> of course have to be replaced with the
actual height and width of the drawable.

Which version of Mono for Android are you using, because the code only
works with Mono for Android 4.0 and up. I also have a sample that
works with 1.9.x.

There also might be a bug in the methods BoundCenterBottom(Drawable
drawable) and BoundCenter(Drawable drawable) in the ItemizedOverlay
which I am investigating right now. That could possibly make the
Drawables not appear to show up on the map.

On Sat, Dec 17, 2011 at 8:47 AM, tequila slammer <[email protected]> wrote:
> I'm trying to add markers to a Google Maps activity. I tested some code
> examples - mostly the ones from Tomasz Cielecki. The code I'm playing around
> with is this basic example
> https://github.com/Cheesebaron/MonoDroid.SimpleOverlayItem.
>
> It works as long as I do not try to set my own marker like this :
>
> <code>
> var test = new MyOverlayItem(new GeoPoint(53, 09), "test", "test test", new
> float[] { 121212 });
> test.SetMarker(marker);
>
> myItemizedOverlay.OverlayItems.Add(test);
> </code>
>
> The app always crashes unexpected right after I hit this method.
>
> public override int Size()
> {
>     return overlayItems.Count;
> }
>
> Can anybody point me in the right direction or can provide me with a working
> code example?
>
> --
> View this message in context: 
> http://mono-for-android.1047100.n5.nabble.com/Add-a-marker-on-Google-Maps-activity-tp5082256p5082256.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> [email protected]
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid



-- 
Med Venlig Hilsen / With Best Regards
Tomasz Cielecki
http://ostebaronen.dk
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to