コード例 #1
0
        public static IntPtr GetConstructorID(IntPtr jclass, object[] args)
        {
            string signature     = _AndroidJNIHelper.GetSignature(args);
            IntPtr constructorID = AndroidJNIHelper.GetConstructorID(jclass, signature);

            if (constructorID == IntPtr.Zero)
            {
                Debug.Warning("JNI: Unable to find constructor method id with signature '" + signature + "'");
            }
            return(constructorID);
        }
コード例 #2
0
        private void _AndroidJavaObject(string className, params object[] args)
        {
            if (args == null)
            {
                args = new object[1];
            }
            className = className.Replace('.', '/');
            IntPtr intPtr = AndroidJNI.FindClass(className);

            this.m_jclass = AndroidJNI.NewGlobalRef(intPtr);
            IntPtr constructorID = AndroidJNIHelper.GetConstructorID(intPtr, args);

            jvalue[] args2 = AndroidJNIHelper.CreateJNIArgArray(args);
            IntPtr   obj   = AndroidJNI.NewObject(intPtr, constructorID, args2);

            this.m_jobject = AndroidJNI.NewGlobalRef(obj);
        }