getDrawable

@Nullable
open fun getDrawable(@NonNull res: @NonNull Resources, @DrawableRes id: Int, @Nullable theme: @Nullable Resources.Theme): @Nullable Drawable

Return a drawable object associated with a particular resource ID and styled for the specified theme. Various types of objects will be returned depending on the underlying resource -- for example, a solid color, PNG image, scalable image, etc.

Return

Drawable An object that can be used to draw this resource.

Parameters

res

resources to use for getting the drawable.

id

The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

theme

The theme used to style the drawable attributes, may be null.

Throws

Throws NotFoundException if the given ID does not exist.