NewGlobalRef() public static method

public static NewGlobalRef ( IntPtr obj ) : IntPtr
obj System.IntPtr
return System.IntPtr
Exemplo n.º 1
0
 private void _AndroidJavaClass(string className)
 {
     base.DebugPrint("Creating AndroidJavaClass from " + className);
     using (AndroidJavaObject androidJavaObject = AndroidJavaObject.FindClass(className))
     {
         this.m_jclass  = AndroidJNI.NewGlobalRef(androidJavaObject.GetRawObject());
         this.m_jobject = IntPtr.Zero;
     }
 }
Exemplo n.º 2
0
 internal AndroidJavaClass(IntPtr jclass)
 {
     if (jclass == IntPtr.Zero)
     {
         throw new Exception("JNI: Init'd AndroidJavaClass with null ptr!");
     }
     this.m_jclass  = AndroidJNI.NewGlobalRef(jclass);
     this.m_jobject = IntPtr.Zero;
 }
Exemplo n.º 3
0
        internal AndroidJavaObject(IntPtr jobject) : this()
        {
            if (jobject == IntPtr.Zero)
            {
                throw new Exception("JNI: Init'd AndroidJavaObject with null ptr!");
            }
            IntPtr objectClass = AndroidJNISafe.GetObjectClass(jobject);

            this.m_jobject = AndroidJNI.NewGlobalRef(jobject);
            this.m_jclass  = AndroidJNI.NewGlobalRef(objectClass);
            AndroidJNISafe.DeleteLocalRef(objectClass);
        }
Exemplo n.º 4
0
 private void _AndroidJavaObject(string className, params object[] args)
 {
     this.DebugPrint("Creating AndroidJavaObject from " + className);
     if (args == null)
     {
         args = new object[1];
     }
     using (AndroidJavaObject androidJavaObject = AndroidJavaObject.FindClass(className))
     {
         this.m_jclass = AndroidJNI.NewGlobalRef(androidJavaObject.GetRawObject());
         jvalue[] jniArgArray = AndroidJNIHelper.CreateJNIArgArray(args);
         try
         {
             IntPtr localref = AndroidJNISafe.NewObject(this.m_jclass, AndroidJNIHelper.GetConstructorID(this.m_jclass, args), jniArgArray);
             this.m_jobject = AndroidJNI.NewGlobalRef(localref);
             AndroidJNISafe.DeleteLocalRef(localref);
         }
         finally
         {
             AndroidJNIHelper.DeleteJNIArgArray(args, jniArgArray);
         }
     }
 }
Exemplo n.º 5
0
 public GlobalJavaObjectRef(IntPtr jobject)
 {
     this.m_jobject = ((jobject == IntPtr.Zero) ? IntPtr.Zero : AndroidJNI.NewGlobalRef(jobject));
 }
Exemplo n.º 6
0
 public GlobalJavaObjectRef(IntPtr jobject)
 {
     this.m_jobject = ((!(jobject == IntPtr.Zero)) ? AndroidJNI.NewGlobalRef(jobject) : IntPtr.Zero);
 }