[mono-android] maps - I'm doing something wrong
Wally McClure
theevilprogrammer at hotmail.com
Wed Nov 9 23:02:28 EST 2011
Thanks Jon. Right now, I'm able to run this code properly on a device. It is not running in the emulator, same error with a null in the map_view. I do have location setup properly in the emulator since it seems to detect my location properly in other apps in the emulator. Any other ideas?
Wally
> From: jonp at xamarin.com
> Date: Wed, 9 Nov 2011 20:54:45 -0500
> To: monodroid at lists.ximian.com
> Subject: Re: [mono-android] maps - I'm doing something wrong
>
> On Nov 9, 2011, at 6:57 PM, Wally McClure wrote:
> > I've got the code below. I have a "real" key determined from the machine that I am running on right now (I know because I just recreated it). The problem that I am running into is that the map_view is sometimes null and sometimes not. Has anyone else seen this behavior?
>
> I'm betting it's a threading problem:
>
> http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MyLocationOverlay.html#runOnFirstFix(java.lang.Runnable)
>
> "as soon as we get a location fix, we'll run it in in a new thread"
>
> Which means this:
>
> > location_overlay.RunOnFirstFix(delegate
> > {
> > map_view.Controller.AnimateTo(location_overlay.MyLocation);
> > });
>
> may invoke `map_view` from the wrong thread. Try changing it to:
>
> location_overlay.RunOnFirstFix (delegate {
> RunOnUiThread (() => map_view.Controller.AnimateTo(location_overlay.MyLocation));
> });
>
> - Jon
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodroid/attachments/20111109/44af203a/attachment.html
More information about the Monodroid
mailing list