getDrawableForDensity

Return a drawable object associated with a particular resource ID for the given screen density in DPI and styled for the specified theme.

Prior to API level 15, the theme and density will not be applied and this method simply calls through to getDrawable.

Prior to API level 21, the theme will not be applied and this method calls through to Resources#getDrawableForDensity(int, int).

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.

density

The desired screen density indicated by the resource as found in DisplayMetrics.

theme

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

Throws

Throws NotFoundException if the given ID does not exist.