Using custom drawings in an Android notification

Is there a way to use the image that I generate on the fly as a Notification icon?

+4
source share
3 answers

This question was discussed in the previous SO question . Result: I do not think this is possible.

UPDATE . For tablets or other widescreen devices at API level 11+, there is a largeIcon property that accepts a Bitmap . AFAIK, this is not used on smaller devices such as phones.

+2
source

Now you can change the main icon using API 11 (Notification.Builder -> setLargeIcon)

+2
source

Try to create a custom type of notifications, then you can use the Bitmap object:

 RemoteViews contentView = new RemoteViews(context.getPackageName(), R.layout.custom_notification_layout); contentView.setImageViewBitmap(R.id.icon_view, myBitmapObject); notification.contentView = contentView; 

For more information, see “ Creating a Custom Enhanced View ” on this page: https://developer.android.com/guide/topics/ui/notifiers/notifications.html p>

0
source

Source: https://habr.com/ru/post/1299221/


All Articles