GetObjectArrayElement() public static method

public static GetObjectArrayElement ( IntPtr array, int index ) : IntPtr
array System.IntPtr
index int
return System.IntPtr
Example #1
0
        public static IntPtr InvokeJavaProxyMethod(AndroidJavaProxy proxy, IntPtr jmethodName, IntPtr jargs)
        {
            int num = 0;

            if (jargs != IntPtr.Zero)
            {
                num = AndroidJNISafe.GetArrayLength(jargs);
            }
            AndroidJavaObject[] array = new AndroidJavaObject[num];
            for (int i = 0; i < num; i++)
            {
                IntPtr objectArrayElement = AndroidJNISafe.GetObjectArrayElement(jargs, i);
                array[i] = ((!(objectArrayElement != IntPtr.Zero)) ? null : new AndroidJavaObject(objectArrayElement));
            }
            IntPtr result;

            using (AndroidJavaObject androidJavaObject = proxy.Invoke(AndroidJNI.GetStringUTFChars(jmethodName), array))
            {
                if (androidJavaObject == null)
                {
                    result = IntPtr.Zero;
                }
                else
                {
                    result = AndroidJNI.NewLocalRef(androidJavaObject.GetRawObject());
                }
            }
            return(result);
        }
Example #2
0
        public static IntPtr InvokeJavaProxyMethod(AndroidJavaProxy proxy, IntPtr jmethodName, IntPtr jargs)
        {
            int arrayLength = 0;

            if (jargs != IntPtr.Zero)
            {
                arrayLength = AndroidJNISafe.GetArrayLength(jargs);
            }
            AndroidJavaObject[] javaArgs = new AndroidJavaObject[arrayLength];
            for (int i = 0; i < arrayLength; i++)
            {
                IntPtr objectArrayElement = AndroidJNISafe.GetObjectArrayElement(jargs, i);
                javaArgs[i] = !(objectArrayElement != IntPtr.Zero) ? null : new AndroidJavaObject(objectArrayElement);
            }
            using (AndroidJavaObject obj2 = proxy.Invoke(AndroidJNI.GetStringUTFChars(jmethodName), javaArgs))
            {
                if (obj2 == null)
                {
                    return(IntPtr.Zero);
                }
                return(AndroidJNI.NewLocalRef(obj2.GetRawObject()));
            }
        }
        public static IntPtr InvokeJavaProxyMethod(AndroidJavaProxy proxy, IntPtr jmethodName, IntPtr jargs)
        {
            int length = 0;

            if (jargs != IntPtr.Zero)
            {
                length = AndroidJNISafe.GetArrayLength(jargs);
            }
            AndroidJavaObject[] javaArgs = new AndroidJavaObject[length];
            for (int index = 0; index < length; ++index)
            {
                IntPtr objectArrayElement = AndroidJNISafe.GetObjectArrayElement(jargs, index);
                javaArgs[index] = !(objectArrayElement != IntPtr.Zero) ? (AndroidJavaObject)null : new AndroidJavaObject(objectArrayElement);
            }
            using (AndroidJavaObject androidJavaObject = proxy.Invoke(AndroidJNI.GetStringUTFChars(jmethodName), javaArgs))
            {
                if (androidJavaObject == null)
                {
                    return(IntPtr.Zero);
                }
                return(AndroidJNI.NewLocalRef(androidJavaObject.GetRawObject()));
            }
        }