Forum Xamarin.Android

How to register my own Application subclass in Xamarin.Android?

KrumelurKrumelur DEUniversity ✭✭
edited January 2014 in Xamarin.Android

I have

public class MyApp : Application
In Java I would add a line to the manifest and pass it the namespace and name of my application:

<application android:icon="@drawable/icon" android:label="@string/app_name"

In Xamarin, there is the [Application] attribute but the documentation states that the Name member is not supported. So how do I get my subclass registered? Where to apply the attribute to?

If I add the attribute to my subclass I get:

System.NotSupportedException: Unable to activate instance of type TestClient_Android.MyApplication from native handle 14d00019


  • KrumelurKrumelur DEUniversity ✭✭
    edited January 2014

    Found it. The documentation is outdated. You will need a special c'tor:

    public class MyApplication : Application
        public MyApplication(IntPtr handle, JniHandleOwnership ownerShip) : base(handle, ownerShip)
Sign In or Register to comment.