Exemplo n.º 1
0
        public ArrayAdapter(Android.Content.Context context, int resource, int textViewResourceId, System.Collections.Generic.IList <T> objects)
            : base(IntPtr.Zero, JniHandleOwnership.DoNotTransfer)
        {
            if (Handle != IntPtr.Zero)
            {
                return;
            }

            IntPtr lrefObjects = JavaList <T> .ToLocalJniHandle(objects);

            if (GetType() == typeof(ArrayAdapter <T>))
            {
                if (id_ctor_Landroid_content_Context_IILjava_util_List_ == IntPtr.Zero)
                {
                    id_ctor_Landroid_content_Context_IILjava_util_List_ = JNIEnv.GetMethodID(class_ref, "<init>", "(Landroid/content/Context;IILjava/util/List;)V");
                }
                SetHandle(
                    JNIEnv.StartCreateInstance(class_ref, id_ctor_Landroid_content_Context_IILjava_util_List_, new JValue(context), new JValue(resource), new JValue(textViewResourceId), new JValue(lrefObjects)),
                    JniHandleOwnership.TransferLocalRef);
                JNIEnv.FinishCreateInstance(Handle, class_ref, id_ctor_Landroid_content_Context_IILjava_util_List_, new JValue(context), new JValue(resource), new JValue(textViewResourceId), new JValue(lrefObjects));
            }
            else
            {
                SetHandle(
                    JNIEnv.StartCreateInstance(GetType(), "(Landroid/content/Context;IILjava/util/List;)V", new JValue(context), new JValue(resource), new JValue(textViewResourceId), new JValue(lrefObjects)),
                    JniHandleOwnership.TransferLocalRef);
                JNIEnv.FinishCreateInstance(Handle, "(Landroid/content/Context;IILjava/util/List;)V", new JValue(context), new JValue(resource), new JValue(textViewResourceId), new JValue(lrefObjects));
            }
            JNIEnv.DeleteLocalRef(lrefObjects);
        }
        Java.Lang.Object ICoordinateContainer.Coordinates()
        {
            var points = Coordinates();

            IntPtr native_p0 = JavaList <Java.Lang.Double> .ToLocalJniHandle(points);

            try {
                return(new Java.Lang.Object(native_p0, JniHandleOwnership.DoNotRegister));
            }
            finally {
                JNIEnv.DeleteLocalRef(native_p0);
            }
        }