1

I want to show an icon on status bar when receive some messages.
The icon represent the number of unread message, so I want to draw some text, such as 2 on the icon.

enter image description here

I tried two solutions but both failed.

  1. set number field (in notification class) as 2 , it seemed this is not supported after android 3.0
  2. set remoteviews on statusbar, using framelayout in remoteViews, but failed. statusbar only show icon, do not show overlayed text.

How can I implement this feature on android 4.1.2?

thanks in advance.

deadfish
  • 11,996
  • 12
  • 87
  • 136
Tony
  • 57
  • 1
  • 5

3 Answers3

1

Use RemoteView in notification. Refer this Link

Community
  • 1
  • 1
Dixit Patel
  • 3,190
  • 1
  • 24
  • 36
0

You should go for BadgeView. It gives you notifications that resemble facebook like numbers

Rashmi.B
  • 1,787
  • 2
  • 18
  • 34
0

You can't do it generally (as you discovered, support for badging the small icon with a number was dropped in Honeycomb since in most cases it made the underlying icon hard to see and understand).

If you feel you must do this, I'd suggest generating 10 or so images with the number embedded into the graphic. For the last one you'd do something like "*" or "9+" to indicate that there are too many updates to be enumerated in such a tight space :)

dsandler
  • 2,471
  • 17
  • 11