Language

Resources.GetString Method

Definition

Overloads

Name Description
GetString(Int32)

Return the string value associated with a particular resource ID.

GetString(Int32, Object[])

Returns a string resource formatted with the supplied arguments.

GetString(Int32)

Return the string value associated with a particular resource ID.

[Android.Runtime.Register("getString", "(I)Ljava/lang/String;", "GetGetString_IHandler")]
public virtual string GetString(int id);
[<Android.Runtime.Register("getString", "(I)Ljava/lang/String;", "GetGetString_IHandler")>]
abstract member GetString : int -> string
override this.GetString : int -> string

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

String The string data associated with the resource, stripped of styled text information.

Attributes

Exceptions

Throws NotFoundException if the given ID does not exist.

Remarks

Return the string value associated with a particular resource ID. It will be stripped of any styled text information. {

Java documentation for android.content.res.Resources.getString(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

GetString(Int32, Object[])

Returns a string resource formatted with the supplied arguments.

[Android.Runtime.Register("getString", "(I[Ljava/lang/Object;)Ljava/lang/String;", "GetGetString_IarrayLjava_lang_Object_Handler")]
public virtual string GetString(int id, params Java.Lang.Object[]? formatArgs);
[<Android.Runtime.Register("getString", "(I[Ljava/lang/Object;)Ljava/lang/String;", "GetGetString_IarrayLjava_lang_Object_Handler")>]
abstract member GetString : int * Java.Lang.Object[] -> string
override this.GetString : int * Java.Lang.Object[] -> string

Parameters

id
Int32

The identifier of the string resource to retrieve. The value 0 is invalid.

formatArgs
Object[]

The arguments used to format the string resource.

Returns

The formatted string associated with id.

Attributes

Remarks

Java documentation for android.content.res.Resources.getString(int, java.lang.Object...).

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