I am using Xamarin, and am getting an error when trying to load an Activity
.
Here is the error:
Android.Content.ActivityNotFoundException: Unable to find explicit activity class {com.xamarin.docs.android.mapsandlocationdemo2/simplemapdemo.MapWithMarkersActivity}; have you declared this activity in your AndroidManifest.xml?
Here is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="5" android:versionName="4.0" package="com.xamarin.docs.android.mapsandlocationdemo2">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="18" />
<!-- Google Maps for Android v2 requires OpenGL ES v2 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- We need to be able to download map tiles and access Google Play Services-->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Allow the application to access Google web-based services. -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- Google Maps for Android v2 will cache map tiles on external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Google Maps for Android v2 needs this permission so that it may check the connection state as it must download data -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- These are optional, but recommended. They will allow Maps to use the My Location provider. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Notice here that we have the package name of our application as a prefix on the permissions. -->
<uses-permission android:name="com.xamarin.docs.android.mapsandlocationdemo2.permission.MAPS_RECEIVE" />
<permission android:name="com.xamarin.docs.android.mapsandlocationdemo2.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
<application android:label="@string/app_name">
<!-- Put your Google Maps V2 API Key here. This key will not work for you.-->
<!-- See https://developers.google.com/maps/documentation/android/start#obtaining_an_api_key -->
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="key_goes_here" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
</application>
</manifest>
The Activity
I am loading is in the namespace SimpleMapDemo
and this is the class declaration:
public class MapWithMarkersActivity : Android.Support.V4.App.FragmentActivity
Here is my layout for the Activity:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:padding="5dip">
<FrameLayout
android:id="@+id/mapWithOverlay"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:layout_below="@+id/thumbnail" />
<ListView
android:id="@+id/List"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="50dp"
android:layout_marginBottom="50dp" />
<EditText
android:id="@+id/inputSearch"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:hint="Find..."
android:layout_alignParentTop="true" />
</RelativeLayout>
Can I please have some help to get this code working?
Thanks in advance
EDIT
This is now in the AndroidManifest.xml
<application android:label="@string/app_name">
<activity android:name="com.xamarin.docs.android.mapsandlocationdemo2/simplemapdemo.MapWithMarkersActivity" android:label="@string/app_name" ></activity>
<!-- Put your Google Maps V2 API Key here. This key will not work for you.-->
<!-- See https://developers.google.com/maps/documentation/android/start#obtaining_an_api_key -->
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="key_goes_here" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
</application>
And this is still the error:
Unable to find explicit activity class {com.xamarin.docs.android.mapsandlocationdemo2/simplemapdemo.MapWithMarkersActivity}; have you declared this activity in your AndroidManifest.xml?
You have to register your activity in the manifest