AndroidJNI

class in UnityEngine

Switch to Manual

Description

用于来自 Mono (CS/JS) 的 Android Dalvik (Java) VM 的“原始”JNI 接口。

注意:必须具备 Android Java 原生接口 (JNI) 的高级知识才能使用原生 JNI 函数。请做好记录。

Static Functions

AllocObject分配新 Java 对象,而不为该对象调用任何构造函数。
AttachCurrentThread将当前线程附加到 Java (Dalvik) VM。
CallBooleanMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallByteMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallCharMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallDoubleMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallFloatMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallIntMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallLongMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallObjectMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallShortMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallStaticBooleanMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticByteMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticCharMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticDoubleMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticFloatMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticIntMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticLongMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticObjectMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticShortMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticStringMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStaticVoidMethodInvokes the specified methodID static method on a Java object, optionally passing in an array of arguments (args).
CallStringMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
CallVoidMethodCalls a Java instance method defined by methodID, optionally passing an array of arguments (args) to the method.
DeleteGlobalRef删除 obj 指向的全局引用。
DeleteLocalRef删除 obj 指向的局部引用。
DetachCurrentThread将当前线程从 Java (Dalvik) VM 中分离。
EnsureLocalCapacity确保可在当前线程中创建不少于指定数量的局部引用。
ExceptionClear清除当前抛出的任何异常。
ExceptionDescribe将堆栈的异常和回溯打印至 logcat
ExceptionOccurred确定是否正在抛出异常。
FatalError引发致命错误,预计 VM 无法恢复。此函数不返回。
FindClass此函数将加载局部定义的类。
FromBooleanArrayConverts a Java array of boolean to a managed array of System.Boolean.
FromByteArrayConverts a Java array of byte to a managed array of System.Byte.
FromCharArrayConverts a Java array of char to a managed array of System.Char.
FromDoubleArrayConverts a Java array of double to a managed array of System.Double.
FromFloatArrayConverts a Java array of float to a managed array of System.Single.
FromIntArrayConverts a Java array of int to a managed array of System.Int32.
FromLongArrayConverts a Java array of long to a managed array of System.Int64.
FromObjectArrayConverts a Java array of java.lang.Object to a managed array of System.IntPtr, representing Java objects.
FromReflectedField将 java.lang.reflect.Field 转换为字段 ID。
FromReflectedMethod将 java.lang.reflect.Method 或 java.lang.reflect.Constructor 对象转换为方法 ID。
FromShortArrayConverts a Java array of short to a managed array of System.Int16.
GetArrayLength返回数组中的元素数。
GetBooleanArrayElement返回原始数组的一个元素的值。
GetBooleanFieldReturns the value of an instance (nonstatic) field of an object.
GetByteArrayElement返回原始数组的一个元素的值。
GetByteFieldReturns the value of an instance (nonstatic) field of an object.
GetCharArrayElement返回原始数组的一个元素的值。
GetCharFieldReturns the value of an instance (nonstatic) field of an object.
GetDoubleArrayElement返回原始数组的一个元素的值。
GetDoubleFieldReturns the value of an instance (nonstatic) field of an object.
GetFieldID返回类的实例(非静态)字段的字段 ID。
GetFloatArrayElement返回原始数组的一个元素的值。
GetFloatFieldReturns the value of an instance (nonstatic) field of an object.
GetIntArrayElement返回原始数组的一个元素的值。
GetIntFieldReturns the value of an instance (nonstatic) field of an object.
GetLongArrayElement返回原始数组的一个元素的值。
GetLongFieldReturns the value of an instance (nonstatic) field of an object.
GetMethodID返回类或接口的实例(非静态)方法的方法 ID。
GetObjectArrayElement返回 Object 数组的一个元素。
GetObjectClass返回对象的类。
GetObjectFieldReturns the value of an instance (nonstatic) field of an object.
GetShortArrayElement返回原始数组的一个元素的值。
GetShortFieldReturns the value of an instance (nonstatic) field of an object.
GetStaticBooleanFieldReturns the value of a static field of an object.
GetStaticByteFieldReturns the value of a static field of an object.
GetStaticCharFieldReturns the value of a static field of an object.
GetStaticDoubleFieldReturns the value of a static field of an object.
GetStaticFieldID返回类的静态字段的字段 ID。
GetStaticFloatFieldReturns the value of a static field of an object.
GetStaticIntFieldReturns the value of a static field of an object.
GetStaticLongFieldReturns the value of a static field of an object.
GetStaticMethodID返回类的静态方法的方法 ID。
GetStaticObjectFieldReturns the value of a static field of an object.
GetStaticShortFieldReturns the value of a static field of an object.
GetStaticStringFieldReturns the value of a static field of an object.
GetStringFieldReturns the value of an instance (nonstatic) field of an object.
GetStringUTFChars返回以 Modified UTF-8 编码表示字符串的托管字符串对象。
GetStringUTFLength返回用 Modified UTF-8表示的字符串的长度,以字节为单位。
GetSuperclass如果 clazz 表示除类 Object 之外的任意类,此函数将返回的对象表示 clazz 所指定类的超类。
GetVersion返回本机方法接口的版本。
IsAssignableFrom确定 clazz1 的对象是否可以安全地转换为 clazz2。
IsInstanceOf测试对象是否为类的一个实例。
IsSameObject测试两个引用是否引用同一 Java 对象。
NewBooleanArrayConstructs a new primitive array object.
NewByteArrayConstructs a new primitive array object.
NewCharArrayConstructs a new primitive array object.
NewDoubleArrayConstructs a new primitive array object.
NewFloatArrayConstructs a new primitive array object.
NewGlobalRef创建对 obj 参数所引用对象的新全局引用。
NewIntArrayConstructs a new primitive array object.
NewLocalRef创建与 obj 引用相同对象的新局部引用。
NewLongArrayConstructs a new primitive array object.
NewObject构建一个新的 Java 对象。方法 ID 指示要调用的构造函数方法。此 ID 必须通过调用 GetMethodID() 来获得,调用时 <init> 作为方法名称,void (V) 作为返回类型。
NewObjectArray构造一个新数组,用于保存类 clazz 中的对象。所有元素最初均设置为 obj。
NewShortArrayConstructs a new primitive array object.
NewStringUTF基于用 Modified UTF-8编码表示的字符数组构造一个新 java.lang.String 对象。
PopLocalFrame弹出当前的局部引用帧,释放所有局部引用,并返回前一局部引用帧中指定 result 对象的局部引用。
PushLocalFrame创建一个新局部引用帧,可在其中创建不少于指定数量的局部引用。
SetBooleanArrayElementSets the boolean value of one element in a primitive array.
SetBooleanFieldSets the value of an instance field of the specified object.
SetByteArrayElementSets the sbyte value of one element in a primitive array.
SetByteFieldSets the value of an instance field of the specified object.
SetCharArrayElementSets the char value of one element in a primitive array.
SetCharFieldSets the value of an instance field of the specified object.
SetDoubleArrayElementSets the double value of one element in a primitive array.
SetDoubleFieldSets the value of an instance field of the specified object.
SetFloatArrayElementSets the float value of one element in a primitive array.
SetFloatFieldSets the value of an instance field of the specified object.
SetIntArrayElementSets the int value of one element in a primitive array.
SetIntFieldSets the value of an instance field of the specified object.
SetLongArrayElementSets the long value of one element in a primitive array.
SetLongFieldSets the value of an instance field of the specified object.
SetObjectArrayElement设置 Object 数组的一个元素。
SetObjectFieldSets the value of an instance field of the specified object.
SetShortArrayElementSets the short value of one element in a primitive array.
SetShortFieldSets the value of an instance field of the specified object.
SetStaticBooleanFieldSets the value of a static field in the specified object.
SetStaticByteFieldSets the value of a static field in the specified object.
SetStaticCharFieldSets the value of a static field in the specified object.
SetStaticDoubleFieldSets the value of a static field in the specified object.
SetStaticFloatFieldSets the value of a static field in the specified object.
SetStaticIntFieldSets the value of a static field in the specified object.
SetStaticLongFieldSets the value of a static field in the specified object.
SetStaticObjectFieldSets the value of a static field in the specified object.
SetStaticShortFieldSets the value of a static field in the specified object.
SetStaticStringFieldSets the value of a static field in the specified object.
SetStringFieldSets the value of an instance field of the specified object.
Throw导致 java.lang.Throwable 对象被抛出。
ThrowNew使用消息指定的 message 基于指定类构造一个异常对象并导致该异常被抛出。
ToBooleanArrayConverts a managed array of System.Boolean to a Java array of boolean.
ToByteArrayConverts a managed array of System.Byte to a Java array of byte.
ToCharArrayConverts a managed array of System.Char to a Java array of char.
ToDoubleArrayConverts a managed array of System.Double to a Java array of double.
ToFloatArrayConverts a managed array of System.Single to a Java array of float.
ToIntArrayConverts a managed array of System.Int32 to a Java array of int.
ToLongArrayConverts a managed array of System.Int64 to a Java array of long.
ToObjectArrayConverts a managed array of System.IntPtr, representing Java objects, to a Java array of java.lang.Object.
ToReflectedField将派生自 cls 的字段 ID 转换为 java.lang.reflect.Field 对象。
ToReflectedMethod将派生自 clazz 的方法 ID 转换为 java.lang.reflect.Method 或 java.lang.reflect.Constructor 对象。
ToShortArrayConverts a managed array of System.Int16 to a Java array of short.