Dynamic Change Launcher Icon and Name for Android App
Dynamic Launcher Icon and Name for Android App
Here is the simple way to change your android apps Launcher icon and Application name dynamically. If you want multiple launcher icons and Application names these Android tutorials for you you can see some simple steps to make you App Dynamic Launcher Icon and Name for Android.
Let’s Start to Create an Android Project and make Dynamic Launcher Icon and Name for Android App.
Step 1. Create a 3 Java Class with the Name of OneLauncher, TwoLauncher, ThreeLauncher.
In this step, you can create a 3 java class with the name reference according to you. After that Add activity-alias in your AndroidManifest.xml. These all 3 class add-in Manifest with the activity-alias teg.
Step 2. Add activity-alias in your AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"></activity>
<activity-alias
android:name="OneLauncherAlias"
android:enabled="true"
android:icon="@mipmap/ic_launcher"
android:label="One"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:name="TwoLauncherAlias"
android:enabled="false"
android:label="Two"
android:icon="@mipmap/ic_launcher1"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:name="ThreeLauncherAlias"
android:enabled="false"
android:label="Three"
android:icon="@mipmap/ic_launcher2"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
</application>
And add these code on buttin click and whare you want to change App icons
PackageManager pm = getPackageManager();
pm.setComponentEnabledSetting(new ComponentName(MainActivity.this, OneLauncher.class), PackageManager.COMPONENT_ENABLED_STATE_ENABLED,PackageManager.DONT_KILL_APP);
pm.setComponentEnabledSetting(new ComponentName(MainActivity.this, TwoLauncher.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
pm.setComponentEnabledSetting(new ComponentName(MainActivity.this, ThreeLauncher.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
Toast.makeText(MainActivity.this, "Launcher one has been applied successfully",Toast.LENGTH_SHORT).show();
See Full Source Code on