Version: 5.5 (switch to 5.6b)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AndroidJNIHelper.GetMethodID

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function GetMethodID(javaClass: IntPtr, methodName: string, signature: string = "", isStatic: bool = false): IntPtr;
public static IntPtr GetMethodID(IntPtr javaClass, string methodName, string signature = "", bool isStatic = false);

Parameters

javaClass Raw JNI Java class object (obtained by calling AndroidJNI.FindClass).
methodName Name of the method as declared in Java.
signature Method signature (e.g. obtained by calling AndroidJNIHelper.GetSignature).
isStatic Set to true for static methods; false for instance (nonstatic) methods.

Description

Scans a particular Java class for a method matching a name and a signature.

The signature comparison is done to allow sub-/base-classes of a class types. If no signature is provided the first method with the correct name will be returned.

See Also: AndroidJNIHelper.GetSignature, AndroidJNIHelper.GetConstructorID, AndroidJNIHelper.GetFieldID.


public static function GetMethodID(jclass: IntPtr, methodName: string, args: object[], isStatic: bool): IntPtr;
public static IntPtr GetMethodID(IntPtr jclass, string methodName, object[] args, bool isStatic);

Parameters

javaClass Raw JNI Java class object (obtained by calling AndroidJNI.FindClass).
methodName Name of the method as declared in Java.
args Array with parameters to be passed to the method when invoked.
isStatic Set to true for static methods; false for instance (nonstatic) methods.

Description

Get a JNI method ID based on calling arguments.

Generic parameter represents the method return type, and the regular method assumes 'void' return type. Scans a particular Java class for a method matching a signature based on passed arguments. The signature comparison is done to allow for sub-/base-classes of the class types.


public static function GetMethodID(jclass: IntPtr, methodName: string, args: object[], isStatic: bool): IntPtr;
public static IntPtr GetMethodID(IntPtr jclass, string methodName, object[] args, bool isStatic);

Parameters

javaClass Raw JNI Java class object (obtained by calling AndroidJNI.FindClass).
methodName Name of the method as declared in Java.
args Array with parameters to be passed to the method when invoked.
isStatic Set to true for static methods; false for instance (nonstatic) methods.

Description

Get a JNI method ID based on calling arguments.

Generic parameter represents the method return type, and the regular method assumes 'void' return type. Scans a particular Java class for a method matching a signature based on passed arguments. The signature comparison is done to allow for sub-/base-classes of the class types.