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: j...@xamarin.com > Date: Wed, 9 Nov 2011 20:54:45 -0500 > To: monodroid@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@lists.ximian.com > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid