Language

JNIEnv.NewObjectArray Method

Definition

Overloads

Name Description
NewObjectArray(Int32, IntPtr)

Creates a Java object array whose elements are initially null.

NewObjectArray(Int32, IntPtr, IntPtr)

Creates a Java object array whose elements are initialized to the specified object.

NewObjectArray<T>(T[])

Creates a Java object array from converted managed values.

NewObjectArray(Int32, IntPtr)

Creates a Java object array whose elements are initially null.

public static IntPtr NewObjectArray(int length, IntPtr elementClass);
static member NewObjectArray : int * nativeint -> nativeint

Parameters

length
Int32

The number of elements. It must be nonnegative.

elementClass
IntPtr

nativeint

A live, non-null JNI reference to the Java element class, usable on the calling thread.

Returns

IntPtr

nativeint

A local JNI reference to the new array, 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

NewObjectArray(Int32, IntPtr, IntPtr)

Creates a Java object array whose elements are initialized to the specified object.

public static IntPtr NewObjectArray(int length, IntPtr elementClass, IntPtr initialElement);
static member NewObjectArray : int * nativeint * nativeint -> nativeint

Parameters

length
Int32

The number of elements. It must be nonnegative.

elementClass
IntPtr

nativeint

A live, non-null JNI reference to the Java element class, usable on the calling thread.

initialElement
IntPtr

nativeint

A live JNI reference to an object compatible with elementClass, usable on the calling thread, or Zero for Java null.

Returns

IntPtr

nativeint

A local JNI reference to the new array, 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

NewObjectArray<T>(T[])

Creates a Java object array from converted managed values.

public static IntPtr NewObjectArray<T>(params T[]? values);
static member NewObjectArray : 'T[] -> nativeint

Type Parameters

T

The managed element type used to choose the Java element class and convert the values.

Parameters

values
T[]

The managed values to convert and copy, or null.

Returns

IntPtr

nativeint

A local JNI reference to the new array, or Zero if values is null. 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