Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to produce an Icon for the Notification.Action.Builder(…) constructor parameter?

Notification.Action.Builder() constructor takes an Icon as input parameter, but I don’t know how to produce an Icon? There seems to be no info on that. Old Builder constructor which takes a drawable Int is now deprecated.

public Builder(Icon icon, CharSequence title, PendingIntent intent) {
    throw new RuntimeException("Stub!");
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The Icon class is an encapsulation class for different kinds of methods to fetch an icon (e.g. bitmap, from file,…)

all (static) methods are listed here

If you want to access an icon by its drawable int, you can do the following:

Icon icon = Icon.createWithResource(context,R.drawable.YOUR_DRAWABLE_REFERENCE);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading