Example usage for Java android.content.res Resources fields, constructors, methods, implement or subclass
The text is from its open source code.
Resources(AssetManager assets, DisplayMetrics metrics, Configuration config) Create a new Resources object on top of an existing set of assets in an AssetManager. |
XmlResourceParser | getAnimation(@AnimatorRes @AnimRes int id) Return an XmlResourceParser through which you can read an animation description for the given resource ID. |
AssetManager | getAssets() Retrieve underlying AssetManager storage for these resources. |
boolean | getBoolean(@BoolRes int id) Return a boolean associated with a particular resource ID. |
int | getColor(@ColorRes int id) Returns a color integer associated with a particular resource ID. |
int | getColor(@ColorRes int id, @Nullable Theme theme) Returns a themed color integer associated with a particular resource ID. |
ColorStateList | getColorStateList(@ColorRes int id) Returns a color state list associated with a particular resource ID. |
ColorStateList | getColorStateList(@ColorRes int id, @Nullable Theme theme) Returns a themed color state list associated with a particular resource ID. |
Configuration | getConfiguration() Return the current configuration that is in effect for this resource object. |
float | getDimension(@DimenRes int id) Retrieve a dimensional for a particular resource ID. |
int | getDimensionPixelOffset(@DimenRes int id) Retrieve a dimensional for a particular resource ID for use as an offset in raw pixels. |
int | getDimensionPixelSize(@DimenRes int id) Retrieve a dimensional for a particular resource ID for use as a size in raw pixels. |
DisplayMetrics | getDisplayMetrics() Return the current display metrics that are in effect for this resource object. |
Drawable | getDrawable(@DrawableRes int id) Return a drawable object associated with a particular resource ID. |
Drawable | getDrawable(@DrawableRes int id, @Nullable Theme theme) Return a drawable object associated with a particular resource ID and styled for the specified theme. |
Drawable | getDrawableForDensity(@DrawableRes int id, int density, @Nullable Theme theme) Return a drawable object associated with a particular resource ID for the given screen density in DPI and styled for the specified theme. |
Drawable | getDrawableForDensity(@DrawableRes int id, int density) Return a drawable object associated with a particular resource ID for the given screen density in DPI. |
float | getFraction(@FractionRes int id, int base, int pbase) Retrieve a fractional unit for a particular resource ID. |
int | getIdentifier(String name, String defType, String defPackage) Return a resource identifier for the given resource name. |
int[] | getIntArray(@ArrayRes int id) Return the int array associated with a particular resource ID. |
int | getInteger(@IntegerRes int id) Return an integer associated with a particular resource ID. |
Movie | getMovie(@RawRes int id) Return a movie object associated with the particular resource ID. |
String | getQuantityString(@PluralsRes int id, int quantity, Object... formatArgs) Formats the string necessary for grammatically correct pluralization of the given resource ID for the given quantity, using the given arguments. |
String | getQuantityString(@PluralsRes int id, int quantity) Returns the string necessary for grammatically correct pluralization of the given resource ID for the given quantity. |
CharSequence | getQuantityText(@PluralsRes int id, int quantity) Returns the character sequence necessary for grammatically correct pluralization of the given resource ID for the given quantity. |
String | getResourceEntryName(@AnyRes int resid) Return the entry name for a given resource identifier. |
String | getResourceName(@AnyRes int resid) Return the full name for a given resource identifier. |
String | getResourcePackageName(@AnyRes int resid) Return the package name for a given resource identifier. |
String | getResourceTypeName(@AnyRes int resid) Return the type name for a given resource identifier. |
String | getString(@StringRes int id) Return the string value associated with a particular resource ID. |
String | getString(@StringRes int id, Object... formatArgs) Return the string value associated with a particular resource ID, substituting the format arguments as defined in java.util.Formatter and java.lang.String#format . |
String[] | getStringArray(@ArrayRes int id) Return the string array associated with a particular resource ID. |
Resources | getSystem() Return a global shared Resources object that provides access to only system resources (no application resources), and is not configured for the current screen (can not use dimension units, does not change based on orientation, etc). |
CharSequence | getText(@StringRes int id) Return the string value associated with a particular resource ID. |
CharSequence[] | getTextArray(@ArrayRes int id) Return the styled text array associated with a particular resource ID. |
void | getValue(@AnyRes int id, TypedValue outValue, boolean resolveRefs) Return the raw data associated with a particular resource ID. |
void | getValue(String name, TypedValue outValue, boolean resolveRefs) Return the raw data associated with a particular resource ID. |
void | getValueForDensity(@AnyRes int id, int density, TypedValue outValue, boolean resolveRefs) Get the raw value associated with a resource with associated density. |
XmlResourceParser | getXml(@XmlRes int id) Return an XmlResourceParser through which you can read a generic XML resource for the given resource ID. |
Theme | newTheme() Generate a new Theme object for this set of Resources. |
TypedArray | obtainAttributes(AttributeSet set, @StyleableRes int[] attrs) Retrieve a set of basic attribute values from an AttributeSet, not performing styling of them using a theme and/or style resources. |
TypedArray | obtainTypedArray(@ArrayRes int id) Return an array of heterogeneous values. |
InputStream | openRawResource(@RawRes int id) Open a data stream for reading a raw resource. |
InputStream | openRawResource(@RawRes int id, TypedValue value) Open a data stream for reading a raw resource. |
AssetFileDescriptor | openRawResourceFd(@RawRes int id) Open a file descriptor for reading a raw resource. |
void | parseBundleExtra(String tagName, AttributeSet attrs, Bundle outBundle) Parse a name/value pair out of an XML tag holding that data. |
void | updateConfiguration(Configuration config, DisplayMetrics metrics) Store the newly updated configuration. |