Bug 18017 - MainLauncher Icon overrides Application Icon
Summary: MainLauncher Icon overrides Application Icon
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.12.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2014-02-26 07:57 UTC by Ginie
Modified: 2014-02-26 13:25 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Ginie 2014-02-26 07:57:05 UTC
Description of Problem:

Setting an icon on an activity that is marked as 'MainLauncher' overrides the used icon in the manifest as 'Application Icon'

Steps to reproduce the problem:
1. Create a new Adnroid Application project
2. Add 2 different icons into the drawable resources eg. icon1.png and icon2.png
3. In AndroidManifest.xml choose icon1.png as the Application Icon
4. In MainActivity choose icon2.png as the Activity Icon eg. 
  [Activity(Label = "Test", MainLauncher = true, Icon = "@drawable/icon2")]
5. Run the application

Actual Results:
The launcher icon is set to icon2.png
The activity icon is set to icon2.png

Expected Results:
The launcher icon is set to icon1.png
The activity icon is set to icon2.png

How often does this happen? 

Additional Information:
Comment 1 Jonathan Pryor 2014-02-26 13:25:45 UTC
> Setting an icon on an activity that is marked as 'MainLauncher' overrides the
> used icon in the manifest as 'Application Icon'

This is By Design and Android-mandated behavior. The ActivityAttribute.Icon property sets the AndroidManifest.xml //activity/@android:icon attribute, which states:

> An icon representing the activity. The icon is displayed to users when a representation
> of the activity is required on-screen. For example, icons for activities that initiate tasks
> are displayed in the launcher window.
> ...
> The activity's icon — whether set here or by the <application> element — is also the
> default icon for all the activity's intent filters (see the <intent-filter> element's icon attribute).

Note that MainLauncher=true is implemented in terms of an <intent-filter/>, and it's this <intent-filter/> which shows up in the Launcher, so it is perfectly appropriate and documented behavior for the ActivityAttribute.Icon value to be used as the app's launcher icon.