getDrawable

fun Resources.getDrawable(name: String, packageName: String): Drawable?

A reflective way to get drawable from resources.

Return

The drawable if found, null otherwise.

Parameters

name

The name of the drawable.

packageName

The package where the resources are contained. This is usually in BuildConfig.LIBRARY_PACKAGE_NAME

Throws

If the resource is not found.