public JSONObject()
        {
#if VERBOSE_LOGGING
            Debug.Log(MethodBase.GetCurrentMethod().Name);
#endif
            JNIFind();
            if (_jcJsonObject == IntPtr.Zero)
            {
                Debug.LogError("_jcJsonObject is not initialized");
                return;
            }
            if (_jmConstructor == IntPtr.Zero)
            {
                Debug.LogError("_jmConstructor is not initialized");
                return;
            }

            _instance = AndroidJNI.AllocObject(_jcJsonObject);
            if (_instance == IntPtr.Zero)
            {
                Debug.LogError("Failed to allocate JSONObject");
                return;
            }

            AndroidJNI.CallVoidMethod(_instance, _jmConstructor, new jvalue[0]);
        }
        public JSONObject(string buffer)
        {
#if VERBOSE_LOGGING
            Debug.Log(MethodBase.GetCurrentMethod().Name);
#endif
            JNIFind();
            if (_jcJsonObject == IntPtr.Zero)
            {
                Debug.LogError("_jcJsonObject is not initialized");
                return;
            }
            if (_jmConstructor2 == IntPtr.Zero)
            {
                Debug.LogError("_jmConstructor2 is not initialized");
                return;
            }

            _instance = AndroidJNI.AllocObject(_jcJsonObject);
            if (_instance == IntPtr.Zero)
            {
                Debug.LogError("Failed to allocate JSONObject");
                return;
            }

            IntPtr arg1 = AndroidJNI.NewStringUTF(buffer);
            AndroidJNI.CallVoidMethod(_instance, _jmConstructor2, new jvalue[] { new jvalue()
                                                                                 {
                                                                                     l = arg1
                                                                                 } });
            AndroidJNI.DeleteLocalRef(arg1);
        }
        public ByteArrayOutputStream()
        {
            _instance = AndroidJNI.AllocObject(_jcByteArrayOutputStream);
            if (_instance == IntPtr.Zero)
            {
                Debug.LogError("Failed to allocate ByteArrayOutputStream");
                return;
            }

            AndroidJNI.CallVoidMethod(_instance, _jmConstructor, new jvalue[0]);

            //Debug.Log("Allocated ByteArrayOutputStream");
        }
Beispiel #4
0
 public JavaObjWrapper(string clazzName)
 {
     this.raw = AndroidJNI.AllocObject(AndroidJNI.FindClass(clazzName));
 }
 public JavaObjWrapper(string clazzName)
 {
     this.cachedRawClass = IntPtr.Zero;
     this.raw            = AndroidJNI.AllocObject(AndroidJNI.FindClass(clazzName));
 }