Language

JNIEnv.NewString Method

Definition

Overloads

Name Description
NewString(String)

Creates a Java string from managed text.

NewString(Char[], Int32)

Creates a Java string from the specified number of characters.

NewString(String)

Creates a Java string from managed text.

public static IntPtr NewString(string? text);
static member NewString : string -> nativeint

Parameters

text
String

The text to copy, or null.

Returns

IntPtr

nativeint

A local JNI string reference, or Zero if no reference is obtained. A nonzero local reference is valid only on its creating thread and may be released with DeleteLocalRef(IntPtr).

Remarks

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

NewString(Char[], Int32)

Creates a Java string from the specified number of characters.

public static IntPtr NewString(char[]? text, int length);
static member NewString : char[] * int -> nativeint

Parameters

text
Char[]

The UTF-16 characters to copy, or null.

length
Int32

The number of characters to copy. For a non-null array, this must be between zero and the array length.

Returns

IntPtr

nativeint

A local JNI string reference, or Zero if no reference is obtained. A nonzero local reference is valid only on its creating thread and may be released with DeleteLocalRef(IntPtr).

Remarks

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