Android Guides | Samples

Android.Content.Res.Resources.GetDrawable Method

Return a drawable object associated with a particular resource ID and styled for the specified theme.

Syntax

[Android.Runtime.Register("getDrawable", "(ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;", "GetGetDrawable_ILandroid_content_res_Resources_Theme_Handler")]
public virtual Drawable GetDrawable (Int32 id, Resources+Theme theme)

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.

Exceptions

TypeReason
!:NoType:android/content/res/Resources$NotFoundException;Href=../../../../reference/android/content/res/Resources.NotFoundException.htmlThrows NotFoundException if the given ID does not exist.

Remarks

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.

[Android Documentation]

Requirements

Namespace: Android.Content.Res
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1