Android Guides | Samples

Android.Content.Res.Resources.GetIdentifier Method

Return a resource identifier for the given resource name.

Syntax

[Android.Runtime.Register("getIdentifier", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I", "GetGetIdentifier_Ljava_lang_String_Ljava_lang_String_Ljava_lang_String_Handler")]
public virtual Int32 GetIdentifier (String name, String defType, String defPackage)

Parameters

name
The name of the desired resource.
defType
Optional default resource type to find, if "type/" is not included in the name. Can be null to require an explicit type.
defPackage
Optional default package to find, if "package:" is not included in the name. Can be null to require an explicit package.

Remarks

Return a resource identifier for the given resource name. A fully qualified resource name is of the form "package:type/entry". The first two components (package and type) are optional if defType and defPackage, respectively, are specified here.

Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.

[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