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 JavaCollection (handle, transfer); else JNIEnv.DeleteRef (handle, transfer); return (ICollection) inst; }
public static IntPtr ToLocalJniHandle(ICollection items) { if (items == null) { return(IntPtr.Zero); } var c = items as JavaCollection; if (c != null) { return(JNIEnv.ToLocalJniHandle(c)); } using (c = new JavaCollection(items)) return(JNIEnv.ToLocalJniHandle(c)); }
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 JavaCollection(handle, transfer); } else { JNIEnv.DeleteRef(handle, transfer); } return((ICollection)inst); }
public static IntPtr ToLocalJniHandle(ICollection items) { if (items == null) return IntPtr.Zero; var c = items as JavaCollection; if (c != null) return JNIEnv.ToLocalJniHandle (c); using (c = new JavaCollection (items)) return JNIEnv.ToLocalJniHandle (c); }