예제 #1
0
 public static IntPtr FromReflectedField(IntPtr refField)
 {
     try { return(AndroidJNI.FromReflectedField(refField)); } finally { CheckException(); }
 }
예제 #2
0
 public static string GetStringUTFChars(IntPtr str)
 {
     try { return(AndroidJNI.GetStringUTFChars(str)); } finally { CheckException(); }
 }
예제 #3
0
 public static IntPtr GetMethodID(IntPtr obj, string name, string sig)
 {
     try { return(AndroidJNI.GetMethodID(obj, name, sig)); } finally { CheckException(); }
 }
예제 #4
0
 public static IntPtr GetObjectArrayElement(IntPtr array, int index)
 {
     try { return(AndroidJNI.GetObjectArrayElement(array, index)); } finally { CheckException(); }
 }
예제 #5
0
 public static IntPtr NewString(string chars)
 {
     try { return(AndroidJNI.NewString(chars)); } finally { CheckException(); }
 }
예제 #6
0
        public static IntPtr ToByteArray(Byte[] array)
        {
#pragma warning disable 0618
            try { return(AndroidJNI.ToByteArray(array)); } finally { CheckException(); }
#pragma warning restore 0618
        }
예제 #7
0
 public static IntPtr ToBooleanArray(bool[] array)
 {
     try { return(AndroidJNI.ToBooleanArray(array)); } finally { CheckException(); }
 }
예제 #8
0
 public static bool CallStaticBooleanMethod(IntPtr clazz, IntPtr methodID, jvalue[] args)
 {
     try { return(AndroidJNI.CallStaticBooleanMethod(clazz, methodID, args)); } finally { CheckException(); }
 }
예제 #9
0
 public static void SetIntField(IntPtr obj, IntPtr fieldID, Int32 val)
 {
     try { AndroidJNI.SetIntField(obj, fieldID, val); } finally { CheckException(); }
 }
예제 #10
0
 public static Int32 GetStaticIntField(IntPtr clazz, IntPtr fieldID)
 {
     try { return(AndroidJNI.GetStaticIntField(clazz, fieldID)); } finally { CheckException(); }
 }
예제 #11
0
 public static void CallStaticVoidMethod(IntPtr clazz, IntPtr methodID, jvalue[] args)
 {
     try { AndroidJNI.CallStaticVoidMethod(clazz, methodID, args); } finally { CheckException(); }
 }
예제 #12
0
 public static void SetStaticIntField(IntPtr clazz, IntPtr fieldID, Int32 val)
 {
     try { AndroidJNI.SetStaticIntField(clazz, fieldID, val); } finally { CheckException(); }
 }
예제 #13
0
 public static IntPtr NewObject(IntPtr clazz, IntPtr methodID, jvalue[] args)
 {
     try { return(AndroidJNI.NewObject(clazz, methodID, args)); } finally { CheckException(); }
 }
예제 #14
0
 public static IntPtr FindClass(string name)
 {
     try { return(AndroidJNI.FindClass(name)); } finally { CheckException(); }
 }
예제 #15
0
 public static bool[] FromBooleanArray(IntPtr array)
 {
     try { return(AndroidJNI.FromBooleanArray(array)); } finally { CheckException(); }
 }
예제 #16
0
 public static bool GetBooleanField(IntPtr obj, IntPtr fieldID)
 {
     try { return(AndroidJNI.GetBooleanField(obj, fieldID)); } finally { CheckException(); }
 }
예제 #17
0
 public static IntPtr ToObjectArray(IntPtr[] array, IntPtr type)
 {
     try { return(AndroidJNI.ToObjectArray(array, type)); } finally { CheckException(); }
 }
예제 #18
0
 public static Int32 GetIntField(IntPtr obj, IntPtr fieldID)
 {
     try { return(AndroidJNI.GetIntField(obj, fieldID)); } finally { CheckException(); }
 }
예제 #19
0
 public static IntPtr ToSByteArray(SByte[] array)
 {
     try { return(AndroidJNI.ToSByteArray(array)); } finally { CheckException(); }
 }
예제 #20
0
 public static void CallVoidMethod(IntPtr obj, IntPtr methodID, jvalue[] args)
 {
     try { AndroidJNI.CallVoidMethod(obj, methodID, args); } finally { CheckException(); }
 }
예제 #21
0
 public static IntPtr ToIntArray(Int32[] array)
 {
     try { return(AndroidJNI.ToIntArray(array)); } finally { CheckException(); }
 }
예제 #22
0
 public static Int32 CallIntMethod(IntPtr obj, IntPtr methodID, jvalue[] args)
 {
     try { return(AndroidJNI.CallIntMethod(obj, methodID, args)); } finally { CheckException(); }
 }
예제 #23
0
 public static int GetArrayLength(IntPtr array)
 {
     try { return(AndroidJNI.GetArrayLength(array)); } finally { CheckException(); }
 }
예제 #24
0
 public static float[] FromFloatArray(IntPtr array)
 {
     try { return(AndroidJNI.FromFloatArray(array)); } finally { CheckException(); }
 }
예제 #25
0
 public static IntPtr NewStringUTF(string bytes)
 {
     try { return(AndroidJNI.NewStringUTF(bytes)); } finally { CheckException(); }
 }
예제 #26
0
 public static Int16[] FromShortArray(IntPtr array)
 {
     try { return(AndroidJNI.FromShortArray(array)); } finally { CheckException(); }
 }
예제 #27
0
 public static IntPtr GetObjectClass(IntPtr ptr)
 {
     try { return(AndroidJNI.GetObjectClass(ptr)); } finally { CheckException(); }
 }
예제 #28
0
 public static SByte[] FromSByteArray(IntPtr array)
 {
     try { return(AndroidJNI.FromSByteArray(array)); } finally { CheckException(); }
 }
예제 #29
0
 public static IntPtr GetFieldID(IntPtr clazz, string name, string sig)
 {
     try { return(AndroidJNI.GetFieldID(clazz, name, sig)); } finally { CheckException(); }
 }
예제 #30
0
        public static ArrayType ConvertFromJNIArray <ArrayType>(IntPtr array)
        {
            Type      elementType = typeof(ArrayType).GetElementType();
            ArrayType result;

            if (AndroidReflection.IsPrimitive(elementType))
            {
                if (elementType == typeof(int))
                {
                    result = (ArrayType)((object)AndroidJNISafe.FromIntArray(array));
                }
                else if (elementType == typeof(bool))
                {
                    result = (ArrayType)((object)AndroidJNISafe.FromBooleanArray(array));
                }
                else if (elementType == typeof(byte))
                {
                    result = (ArrayType)((object)AndroidJNISafe.FromByteArray(array));
                }
                else if (elementType == typeof(short))
                {
                    result = (ArrayType)((object)AndroidJNISafe.FromShortArray(array));
                }
                else if (elementType == typeof(long))
                {
                    result = (ArrayType)((object)AndroidJNISafe.FromLongArray(array));
                }
                else if (elementType == typeof(float))
                {
                    result = (ArrayType)((object)AndroidJNISafe.FromFloatArray(array));
                }
                else if (elementType == typeof(double))
                {
                    result = (ArrayType)((object)AndroidJNISafe.FromDoubleArray(array));
                }
                else if (elementType == typeof(char))
                {
                    result = (ArrayType)((object)AndroidJNISafe.FromCharArray(array));
                }
                else
                {
                    result = default(ArrayType);
                }
            }
            else if (elementType == typeof(string))
            {
                int      arrayLength = AndroidJNISafe.GetArrayLength(array);
                string[] array2      = new string[arrayLength];
                for (int i = 0; i < arrayLength; i++)
                {
                    IntPtr objectArrayElement = AndroidJNI.GetObjectArrayElement(array, i);
                    array2[i] = AndroidJNISafe.GetStringUTFChars(objectArrayElement);
                    AndroidJNISafe.DeleteLocalRef(objectArrayElement);
                }
                result = (ArrayType)((object)array2);
            }
            else
            {
                if (elementType != typeof(AndroidJavaObject))
                {
                    throw new Exception("JNI: Unknown generic array type '" + elementType + "'");
                }
                int arrayLength2           = AndroidJNISafe.GetArrayLength(array);
                AndroidJavaObject[] array3 = new AndroidJavaObject[arrayLength2];
                for (int j = 0; j < arrayLength2; j++)
                {
                    IntPtr objectArrayElement2 = AndroidJNI.GetObjectArrayElement(array, j);
                    array3[j] = new AndroidJavaObject(objectArrayElement2);
                    AndroidJNISafe.DeleteLocalRef(objectArrayElement2);
                }
                result = (ArrayType)((object)array3);
            }
            return(result);
        }