共用方式為


Resources.GetText Method

Definition

Overloads

GetText(Int32)

Return the string value associated with a particular resource ID.

GetText(Int32, String)

Return the string value associated with a particular resource ID.

GetText(Int32)

Return the string value associated with a particular resource ID.

public string GetText (int id);
member this.GetText : 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

CharSequence The string data associated with the resource, plus possibly styled text information.

Remarks

Return the string value associated with a particular resource ID. The returned object will be a String if this is a plain string; it will be some other type of CharSequence if it is styled. {

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

GetText(Int32, String)

Return the string value associated with a particular resource ID.

public string? GetText (int id, string? def);
member this.GetText : int * string -> 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.

def
String

The default CharSequence to return.

Returns

CharSequence The string data associated with the resource, plus possibly styled text information, or def if id is 0 or not found.

Remarks

Return the string value associated with a particular resource ID. The returned object will be a String if this is a plain string; it will be some other type of CharSequence if it is styled.

Java documentation for android.content.res.Resources.getText(int, java.lang.CharSequence).

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