Android APIs
public class

ResourcesCompat

extends Object
java.lang.Object
   ↳ android.support.v4.content.res.ResourcesCompat

Class Overview

Helper for accessing features in Resources introduced after API level 4 in a backwards compatible fashion.

Summary

Public Constructors
ResourcesCompat()
Public Methods
Drawable getDrawable(Resources res, int id, Resources.Theme theme)
Return a drawable object associated with a particular resource ID and styled for the specified theme.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ResourcesCompat ()

Public Methods

public Drawable getDrawable (Resources res, int id, Resources.Theme theme)

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.

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

Parameters
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.
Returns
  • Drawable An object that can be used to draw this resource.
Throws
Resources.NotFoundException Throws NotFoundException if the given ID does not exist.