Changing the Android App Icon Programmatically

<p>Searching for a solution online is relatively easy. However, what intrigued me was the reaction on StackOverflow whenever someone asked for a way to implement this. Respondents often insist that it&rsquo;s impossible, despite the existence of workarounds.</p> <h1>If there are workarounds, then it is not impossible</h1> <p>&nbsp;</p> <p>Sometimes, the answers on StackOverflow can be contradicting.</p> <p>This solution has been circulating for years. Although some users have reported issues on certain phones, the method works for me. Therefore, I&rsquo;d like to share it here, as it&rsquo;s not particularly difficult to implement.</p> <h2>The Underlying Working Principle</h2> <p>We can create multiple launcher icons by declaring&nbsp;<code><strong>activity-alias</strong></code>&nbsp;elements in&nbsp;<code><strong>AndroidManifest.xml</strong></code>. The effect of changing the app icon is achieved by disabling the current one and enabling a new one.</p> <h1>Defining the App Icons in AndroidManifest.xml</h1> <p>Though we aim to change the app icon programmatically, we still need to hardcode a predefined set of icons. This allows us to switch between them programmatically. For example, the following code creates three extra launcher icons besides the default one.</p> <p><a href="https://medium.com/@callmeryan/changing-the-android-app-icon-programmatically-c913550330d">Visit Now</a></p>