Language

JniEnvironment.InstanceMethods.GetMethodID Method

Definition

Overloads

Name Description
GetMethodID(JniObjectReference, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Looks up a JNI instance method ID using null-terminated UTF-8 name and signature spans. Use with "methodName"u8 literals to avoid string marshalling overhead.

GetMethodID(JniObjectReference, String, String)

Resolves a JNI instance method or constructor identifier.

GetMethodID(JniObjectReference, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Looks up a JNI instance method ID using null-terminated UTF-8 name and signature spans. Use with "methodName"u8 literals to avoid string marshalling overhead.

public static Java.Interop.JniMethodInfo GetMethodID(Java.Interop.JniObjectReference type, ReadOnlySpan<byte> name, ReadOnlySpan<byte> signature);
static member GetMethodID : Java.Interop.JniObjectReference * ReadOnlySpan<byte> * ReadOnlySpan<byte> -> Java.Interop.JniMethodInfo

Parameters

type
JniObjectReference

A valid reference to the Java class used for method lookup.

name
ReadOnlySpan<Byte>

The zero-terminated Java method name, or <init> for a constructor, encoded as modified UTF-8.

signature
ReadOnlySpan<Byte>

The zero-terminated JNI method descriptor encoded as modified UTF-8.

Returns

Valid JNI information for the instance method or constructor.

Remarks

Both spans must include terminating zero bytes. Their bytes are passed to JNI without transcoding or length arguments. A pending Java exception from lookup is converted to a managed exception.

Applies to

GetMethodID(JniObjectReference, String, String)

Resolves a JNI instance method or constructor identifier.

public static Java.Interop.JniMethodInfo GetMethodID(Java.Interop.JniObjectReference type, string name, string signature);
static member GetMethodID : Java.Interop.JniObjectReference * string * string -> Java.Interop.JniMethodInfo

Parameters

type
JniObjectReference

A valid reference to the Java class used for method lookup.

name
String

The Java method name, or <init> for a constructor.

signature
String

The JNI method descriptor.

Returns

Valid JNI information for the instance method or constructor.

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