6

I want to create a launcher icon similar to the native Messaging application in Android. The icon of this app has an image but also have a dynamically changing number(a counter of some sort that corresponds to the number of unread messages). Also this icon it is not an widget, as it's an actual icon that's present in the application drawer.

Can someone explain to me how I can go about to achieve this? I found some solution that includes a widget with the dimensions set to 1x1 but I do not want people to add shortcuts to my app as widget. If possible, I'd want to manipulate the launcher icon in some programmatical way.

Thanks in advance!

Note: There is a question similar to mine asked a long time ago. However, seeing that the Android API has gone through a lot of changes since then, the older answers may or may not be applicable - hence the need for a new question. (link)

Community
  • 1
  • 1
Lukap
  • 29,596
  • 60
  • 146
  • 239

2 Answers2

7

Can someone explain me how can I do this ?

You can't, short of creating your own home screen with your own launcher.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253
  • I've seen the Messaging-icon get the "number of unread messages" placed on it at various occasions- is that launcher-specific? – karllindmark Jan 29 '12 at 19:17
  • 1
    @ninetwozero: It should be launcher-specific, yes. A launcher would have to have those smarts itself. You can test this by trying out something like the SDK's Home sample app and seeing what the launcher icon looks like. – CommonsWare Jan 29 '12 at 19:20
  • +1 The only two ways I know to achieve that are: 1) launcher code (most advanced launchers do that for email, gmail, SMS, phone calls, etc.) and 2) 1x1 widget that mimics an icon – Guillaume Jan 29 '12 at 19:22
  • @Guillaume can you please give me some guidelines about the first option > 1) launcher code – Lukap Jan 29 '12 at 19:25
0

You cannot make an Dynamic launcher icon.

Alternatively, you can design a Home Screen Widget similar to your icon which can update itself.

Here's a tutorial on how to make a Home Screen Widget.

If you need to get that on the Menu of an Android Device, I think it is necessary what @CommonsWare said.

Keval
  • 61
  • 1
  • 9