Пример #1
0
        public static IntPtr ToLocalJniHandle(ICollection items)
        {
            if (items == null)
            {
                return(IntPtr.Zero);
            }

            var s = items as JavaSet;

            if (s != null)
            {
                return(JNIEnv.ToLocalJniHandle(s));
            }

            using (s = new JavaSet(items))
                return(JNIEnv.ToLocalJniHandle(s));
        }
Пример #2
0
        public static ICollection FromJniHandle(IntPtr handle, JniHandleOwnership transfer)
        {
            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            IJavaObject inst = (IJavaObject)Java.Lang.Object.PeekObject(handle);

            if (inst == null)
            {
                inst = new JavaSet(handle, transfer);
            }
            else
            {
                JNIEnv.DeleteRef(handle, transfer);
            }

            return((ICollection)inst);
        }
Пример #3
0
        public static IntPtr ToLocalJniHandle(ICollection items)
        {
            if (items == null)
                return IntPtr.Zero;

            var s = items as JavaSet;
            if (s != null)
                return JNIEnv.ToLocalJniHandle (s);

            using (s = new JavaSet (items))
                return JNIEnv.ToLocalJniHandle (s);
        }
Пример #4
0
        public static ICollection FromJniHandle(IntPtr handle, JniHandleOwnership transfer)
        {
            if (handle == IntPtr.Zero)
                return null;

            IJavaObject inst = Java.Lang.Object.PeekObject (handle);
            if (inst == null)
                inst = new JavaSet (handle, transfer);
            else
                JNIEnv.DeleteRef (handle, transfer);

            return (ICollection) inst;
        }