2

I want to show a number in the status bar, like all the battery apps do (when they show the percentage of the battery in the status bar, usually with a persistent notification).

It seems that I can't set a text to appear on the status bar, only an image.

So is the only way is to create X images (e.g. 100 images for battery apps each with a different name) and to switch between them?

Thanks.

2
  • 1
    Share the code how you are doing it . Then we may be able to help ?? Commented Dec 28, 2012 at 14:02
  • there is no code, I'm looking for one. The standard notification code can be seen here: developer.android.com/guide/topics/ui/notifiers/… . I just want to display text instead of an icon on the status bar. Commented Dec 28, 2012 at 14:07

1 Answer 1

2

Use setNumber() with your Notification.Builder or NotificationCompat.Builder.

Sign up to request clarification or add additional context in comments.

4 Comments

but that number appears on the notification. I want to show a number on the status bar, like in play.google.com/store/apps/…
@Ran: Well, that "number" is a Notification. You either go with 100 images or you use setNumber().
I actually wanted to display a decimal number, so I would need infinite images. :) Thanks.
@Ran: Unfortunately, in most cases, these images have to be resources. I think the "large" image can be a Bitmap, which you could build on the fly, but that will only be used in some circumstances (e.g., Android 3.x tablets).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.