Michael_19
Michael_19

Reputation: 4969

How to create notification icon badge on Android apps (like iPhone)

I am very new to programming and would like to know what is the best way to go about creating a notification icon badge similar to the ones on the iPhone apps. This would be basically for creating a badge for the notifications that end up in the notification bar.

Upvotes: 8

Views: 8715

Answers (2)

Macarse
Macarse

Reputation: 93183

This is actually an answer from Mark Murphy:

For most phones, you use the number field of the Notification object. See here: http://github.com/commonsguy/cw-android/tree/master/Notifications/Notify1/

Now, there are a few phones by one major device manufacturer that have a bug, whereby the number field is ignored. I am working on getting them to fix it. So you can't absolutely rely on that red bubble being there, though it will be on most phones.

Upvotes: 3

Billy Bob Bain
Billy Bob Bain

Reputation: 2895

Are you talking about a graphical icon? I created a transparent PNG using the gimp and pass that drawable id as the 1st argument to the Notification constructor.

Notification notification = new Notification(R.drawable.someicon,title,System.currentTimeMillis())

Upvotes: 2

Related Questions