[mono-android] MapView exception
Tomasz Cielecki
tomasz at ostebaronen.dk
Thu Dec 8 03:58:45 EST 2011
I suggest you to check out the MapsDemo in the samples on github:
https://github.com/xamarin/monodroid-samples/tree/master/MapsDemo
I am not sure if you can get the MapView like that, so an alternative
method would be to instantiate it yourself, which isn't that hard.
I have a sample I made for 1.9.2 here:
https://github.com/Cheesebaron/MonoDroid.GoogleMapsDemo/blob/master/MapActivity.cs
it works with 4.0 as well.
On Wed, Dec 7, 2011 at 10:01 AM, laurar81 <laura.ruggeri at station.it> wrote:
> I work with mapsdemo example.
> This is the mapview.xml
>
>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
> android:id="@+id/main"
> android:layout_width="match_parent"
> android:layout_height="match_parent">
> <com.google.android.maps.MapView
> android:id="@+id/mapview1"
> android:layout_width="match_parent"
> android:layout_height="match_parent"
> android:enabled="true"
> android:clickable="true"
> android:apiKey="0NEYgdOup6yIBCe9gExhOXFMJGERVVN_mrIQqpQ"
> />
> </LinearLayout>
>
>
> In OnCreate find the mapview1 but the cast MapView is invalid exception:
>
> MapView mapView = (MapView)FindViewById(Resource.Id.mapview1)
>
> This is the errore message:
>
> Message "Cannot cast from source type to destination type." string
>
>
> I followed the example of the official guide to java
>
> --
> View this message in context: http://mono-for-android.1047100.n5.nabble.com/MapView-exception-tp5054906p5054906.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
--
Med Venlig Hilsen / With Best Regards
Tomasz Cielecki
http://ostebaronen.dk
More information about the Monodroid
mailing list