Hello I am looking for the way to set the bitmap which are not in res
directory. Actually I am getting that icon from the URL and want to set it in the notification area.
Here I am doing but it is only set the icon which are in res
directory.
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_stat_logo)
.setContentTitle(Util.notificationTitle)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(notificationMessage))
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_SOUND)
.setContentText(notificationMessage);
Any idea to set the fetch bitmap from URL and set that icon as Notification
icon ?
Already answered here: https://stackoverflow.com/a/16055373/1071594
Summary: It's not possible to set a custom small icon, but from API level 11 you can use setLargeIcon() after you have downloaded your image and converted it to a Bitmap.
[edit] There is another solution: If you create a completely custom notification with its own view, you could put anything inside that view, including downloaded images.
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