Create a notification with saved icon

孤街浪徒 提交于 2019-12-10 19:52:47

问题


In my application the user pick an application from list of applications installed on their phone.

I want to create a notification with an icon of the choosen application.

The problem is that I can't save the icon inside my application, and if I save it somethere else I won't be able to get the icon by id, as it needed to create a notification.

How can I solve this?


回答1:


you can not add or edit the resource of res folder. And as the main icon of notification is provided as an icon id so you can not change by dynamic images from program. But there is another icon option in the notification. it is a small icon (althgouh it is called large icon!! dont know why) at the right side of the notification. you can set it by sending Bitmap as parameter.

you can see the look of this icon in this link. see the number 6 of normal view.

To set this icon you can use setLargeIcon method.



来源:https://stackoverflow.com/questions/16044594/create-a-notification-with-saved-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!