I want to draw something on a pic , after do that , it is a Bitmap . i want to add this Bitmap to the Notification as its icon. but it the icon must be a int Id . How can i make it? thanks for your answer~~~~ pls hlep me!
To add an image in your notification, pass an instance of NotificationCompat. BigPictureStyle to setStyle() .
Navigate to Messages > New Push > Platform Settings > Google Android Options > Set the icon name without the file extension. With Large Notification Icons, you can also supply a URL where the icon will be displayed from.
Builder class for NotificationCompat objects. Allows easier control over all the flags, as well as help constructing the typical notification layouts. On platform versions that don't offer expanded notifications, methods that depend on expanded notifications have no effect.
From this Post i came to know that Notification icon will take Resources image. So You cant do dynamic in Small icon. But you can do for large icon from Api Level 11.
For that you can use Notificaiton.Builder
Refer here
Other way is also there. That is you can change icon that appears when notification in pulled down. For that you have to Use RemoteViews
Refer here
You can put image file in res->drawable (or drawable-hdpi,ldpi,mdpi), for example notify.png and use it
myNotification = new Notification(R.id.notify, "Notification!", System.currentTimeMillis());
or
Try using AnimationDrawable's. You can use them to combine multiple drawables into a single one, and select the one you want to display. I really think, this is the way to go.
More info: AnimationDrawable
Off course, you will have to provide individual drawables for all your Integers you want to display, but this way, you can easily change the appearance of your notifications
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With