Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i set the application icon programmatically android

Tags:

android

icons

I know that we can set it through manifest file using android:icon attribute.But how can we set it in java code?

like image 370
Satya Avatar asked Jan 30 '12 09:01

Satya


1 Answers

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.

like image 68
ChrLipp Avatar answered Sep 30 '22 14:09

ChrLipp