Search code examples
xamarinxamarin.formsxamarin.android

Android Label/Icon - in AndroidManifest/Build options vs MainActivity


In a Xamarin project, I can set the Android Label and Icon directly via the Build Options UI - which I believe updates the AndroidManifest.xml file

enter image description here

And I can also set it in code like so above the MainActivity class:

 [Activity(Label = "MyXamApp", Icon = "@mipmap/ic_launcher", Theme = "@style/MyXamApp.Splash",
        MainLauncher = true,

Does one take precedence over the other, do I need both, which is the correct way?


Solution

  • When you set the icon in Option, it will then be used to automatically generate the manifest for you. This is the default value for the Android project.

    When you set the Icon, Label in Activity, it would reset the Icon, Label at runtime.

    Normally, we would set our own Icon, Label in Activity. If you do not set it again, it would use the Icon, Label value in AndroidManifest file.