I know that we can set it through manifest file using android:icon attribute.But how can we set it in java code?
Asked
Active
Viewed 3,171 times
2 Answers
5
It doesn't make sense to set it programmatically, the launcher has to display the application icon when the application isn't active.
If you take a look at How to change an application icon programmatically in Android?, you will find a comment, which links to this sample code in the Android developer API demos: LaucherShortcuts.
It seams that the Activity can create a LauncherShortcut, which can have a different icon (see function setupShortcut()). If you want the user to select the Icon, you have to display a list of icons when creating the shortcut. But again, it is a shortcut. In the list of application the original icon appears.
-
I think the apps that "appear" to change the launcher icon at run time are doing so using a widget rather than a real launcher shortcut. – Kuffs Jan 30 '12 at 12:52
-
@KUFFS:can you some examples so that i can work around that....i have tried to search but failed... – Satya Jan 30 '12 at 14:57