AndroidJNI Manual     Reference     Scripting  
Scripting > Runtime Classes > AndroidJNI
AndroidJNI

'Raw' JNI interface to Android Dalvik (Java) VM from Mono (CS/JS)

Class Functions
AttachCurrentThread

Attaches the current thread to a Java (Dalvik) VM.

DetachCurrentThread

Detaches the current thread from a Java (Dalvik) VM.

GetVersion

Returns the version of the native method interface.

FindClass

This function loads a locally-defined class.

FromReflectedMethod

Converts a java.lang.reflect.Method or java.lang.reflect.Constructor object to a method ID.

FromReflectedField

Converts a java.lang.reflect.Field to a field ID.

ToReflectedMethod

Converts a method ID derived from clazz to a java.lang.reflect.Method or java.lang.reflect.Constructor object.

ToReflectedField

Converts a field ID derived from cls to a java.lang.reflect.Field object.

GetSuperclass

If clazz represents any class other than the class Object, then this function returns the object that represents the superclass of the class specified by clazz.

IsAssignableFrom

Determines whether an object of clazz1 can be safely cast to clazz2.

Throw

Causes a java.lang.Throwable object to be thrown.

ThrowNew

Constructs an exception object from the specified class with the message specified by message and causes that exception to be thrown.

ExceptionOccurred

Determines if an exception is being thrown

ExceptionDescribe

Prints an exception and a backtrace of the stack to the logcat

ExceptionClear

Clears any exception that is currently being thrown.

FatalError

Raises a fatal error and does not expect the VM to recover. This function does not return.

PushLocalFrame

Creates a new local reference frame, in which at least a given number of local references can be created.

PopLocalFrame

Pops off the current local reference frame, frees all the local references, and returns a local reference in the previous local reference frame for the given result object.

NewGlobalRef

Creates a new global reference to the object referred to by the obj argument.

DeleteGlobalRef

Deletes the global reference pointed to by obj.

NewLocalRef

Creates a new local reference that refers to the same object as obj.

DeleteLocalRef

Deletes the local reference pointed to by obj.

IsSameObject

Tests whether two references refer to the same Java object.

EnsureLocalCapacity

Ensures that at least a given number of local references can be created in the current thread.

AllocObject

Allocates a new Java object without invoking any of the constructors for the object.

NewObject

Constructs a new Java object. The method ID indicates which constructor method to invoke. This ID must be obtained by calling GetMethodID() with as the method name and void (V) as the return type.

GetObjectClass

Returns the class of an object.

IsInstanceOf

Tests whether an object is an instance of a class.

GetMethodID

Returns the method ID for an instance (nonstatic) method of a class or interface.

GetFieldID

Returns the field ID for an instance (nonstatic) field of a class.

GetStaticMethodID

Returns the method ID for a static method of a class.

GetStaticFieldID

Returns the field ID for a static field of a class.

NewStringUTF

Constructs a new java.lang.String object from an array of characters in modified UTF-8 encoding.

GetStringUTFLength

Returns the length in bytes of the modified UTF-8 representation of a string.

GetStringUTFChars

Returns a managed string object representing the string in modified UTF-8 encoding.

CallStringMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallObjectMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallIntMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallBooleanMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallShortMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallByteMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallCharMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallFloatMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallDoubleMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallLongMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

CallVoidMethod

Calls an instance (nonstatic) Java method defined by methodID, optionally passing an array of arguments (args) to the method.

GetStringField

This function returns the value of an instance (nonstatic) field of an object.

GetObjectField

This function returns the value of an instance (nonstatic) field of an object.

GetBooleanField

This function returns the value of an instance (nonstatic) field of an object.

GetByteField

This function returns the value of an instance (nonstatic) field of an object.

GetCharField

This function returns the value of an instance (nonstatic) field of an object.

GetShortField

This function returns the value of an instance (nonstatic) field of an object.

GetIntField

This function returns the value of an instance (nonstatic) field of an object.

GetLongField

This function returns the value of an instance (nonstatic) field of an object.

GetFloatField

This function returns the value of an instance (nonstatic) field of an object.

GetDoubleField

This function returns the value of an instance (nonstatic) field of an object.

SetStringField

This function sets the value of an instance (nonstatic) field of an object.

SetObjectField

This function sets the value of an instance (nonstatic) field of an object.

SetBooleanField

This function sets the value of an instance (nonstatic) field of an object.

SetByteField

This function sets the value of an instance (nonstatic) field of an object.

SetCharField

This function sets the value of an instance (nonstatic) field of an object.

SetShortField

This function sets the value of an instance (nonstatic) field of an object.

SetIntField

This function sets the value of an instance (nonstatic) field of an object.

SetLongField

This function sets the value of an instance (nonstatic) field of an object.

SetFloatField

This function sets the value of an instance (nonstatic) field of an object.

SetDoubleField

This function sets the value of an instance (nonstatic) field of an object.

CallStaticStringMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticObjectMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticIntMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticBooleanMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticShortMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticByteMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticCharMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticFloatMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticDoubleMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticLongMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

CallStaticVoidMethod

Invokes a static method on a Java object, according to the specified methodID, optionally passing an array of arguments (args) to the method.

GetStaticStringField

This function returns the value of a static field of an object.

GetStaticObjectField

This function returns the value of a static field of an object.

GetStaticBooleanField

This function returns the value of a static field of an object.

GetStaticByteField

This function returns the value of a static field of an object.

GetStaticCharField

This function returns the value of a static field of an object.

GetStaticShortField

This function returns the value of a static field of an object.

GetStaticIntField

This function returns the value of a static field of an object.

GetStaticLongField

This function returns the value of a static field of an object.

GetStaticFloatField

This function returns the value of a static field of an object.

GetStaticDoubleField

This function returns the value of a static field of an object.

SetStaticStringField

This function ets the value of a static field of an object.

SetStaticObjectField

This function ets the value of a static field of an object.

SetStaticBooleanField

This function ets the value of a static field of an object.

SetStaticByteField

This function ets the value of a static field of an object.

SetStaticCharField

This function ets the value of a static field of an object.

SetStaticShortField

This function ets the value of a static field of an object.

SetStaticIntField

This function ets the value of a static field of an object.

SetStaticLongField

This function ets the value of a static field of an object.

SetStaticFloatField

This function ets the value of a static field of an object.

SetStaticDoubleField

This function ets the value of a static field of an object.

ToBooleanArray

Convert a managed array of System.Boolean to a Java array of boolean.

ToByteArray

Convert a managed array of System.Byte to a Java array of byte.

ToCharArray

Convert a managed array of System.Char to a Java array of char.

ToShortArray

Convert a managed array of System.Int16 to a Java array of short.

ToIntArray

Convert a managed array of System.Int32 to a Java array of int.

ToLongArray

Convert a managed array of System.Int64 to a Java array of long.

ToFloatArray

Convert a managed array of System.Single to a Java array of float.

ToDoubleArray

Convert a managed array of System.Double to a Java array of double.

ToObjectArray

Convert a managed array of System.IntPtr, representing Java objects, to a Java array of java.lang.Object.

FromBooleanArray

Convert a Java array of boolean to a managed array of System.Boolean.

FromByteArray

Convert a Java array of byte to a managed array of System.Byte.

FromCharArray

Convert a Java array of char to a managed array of System.Char.

FromShortArray

Convert a Java array of short to a managed array of System.Int16.

FromIntArray

Convert a Java array of int to a managed array of System.Int32.

FromLongArray

Convert a Java array of long to a managed array of System.Int64.

FromFloatArray

Convert a Java array of float to a managed array of System.Single.

FromDoubleArray

Convert a Java array of double to a managed array of System.Double.

FromObjectArray

Convert a Java array of java.lang.Object to a managed array of System.IntPtr, representing Java objects.

GetArrayLength

Returns the number of elements in the array.

NewBooleanArray

Construct a new primitive array object.

NewByteArray

Construct a new primitive array object.

NewCharArray

Construct a new primitive array object.

NewShortArray

Construct a new primitive array object.

NewIntArray

Construct a new primitive array object.

NewLongArray

Construct a new primitive array object.

NewFloatArray

Construct a new primitive array object.

NewDoubleArray

Construct a new primitive array object.

NewObjectArray

Constructs a new array holding objects in class clazz. All elements are initially set to obj.

GetBooleanArrayElement

Returns the value of one element of a primitive array.

GetByteArrayElement

Returns the value of one element of a primitive array.

GetCharArrayElement

Returns the value of one element of a primitive array.

GetShortArrayElement

Returns the value of one element of a primitive array.

GetIntArrayElement

Returns the value of one element of a primitive array.

GetLongArrayElement

Returns the value of one element of a primitive array.

GetFloatArrayElement

Returns the value of one element of a primitive array.

GetDoubleArrayElement

Returns the value of one element of a primitive array.

GetObjectArrayElement

Returns an element of an Object array.

SetBooleanArrayElement

Sets the value of one element in a primitive array.

SetByteArrayElement

Sets the value of one element in a primitive array.

SetCharArrayElement

Sets the value of one element in a primitive array.

SetShortArrayElement

Sets the value of one element in a primitive array.

SetIntArrayElement

Sets the value of one element in a primitive array.

SetLongArrayElement

Sets the value of one element in a primitive array.

SetFloatArrayElement

Sets the value of one element in a primitive array.

SetDoubleArrayElement

Sets the value of one element in a primitive array.

SetObjectArrayElement

Sets an element of an Object array.