Share via


Context.GetDrawable(Int32) Method

Definition

Returns a drawable object associated with a particular resource ID and styled for the current theme.

[Android.Runtime.Register("getDrawable", "(I)Landroid/graphics/drawable/Drawable;", "")]
public Android.Graphics.Drawables.Drawable? GetDrawable (int id);
[<Android.Runtime.Register("getDrawable", "(I)Landroid/graphics/drawable/Drawable;", "")>]
member this.GetDrawable : int -> Android.Graphics.Drawables.Drawable

Parameters

id
Int32

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.

Returns

An object that can be used to draw this resource.

Attributes

Exceptions

if the given ID does not exist.

Remarks

Returns a drawable object associated with a particular resource ID and styled for the current theme.

Java documentation for android.content.Context.getDrawable(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to