getColor

open fun getColor(@NonNull res: @NonNull Resources, @ColorRes id: Int, @Nullable theme: @Nullable Resources.Theme): Int

Returns a themed color integer associated with a particular resource ID. If the resource holds a complex ColorStateList, then the default color from the set is returned.

Return

A single color value in the form 0xAARRGGBB.

Parameters

res

resources to use for getting the color.

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 color attributes, may be null.

Throws

Throws NotFoundException if the given ID does not exist.