public static JniObjectReference NewObject(JniObjectReference type, JniMethodInfo method) { JniEnvironment.WithinNewObjectScope = true; try { return(_NewObject(type, method)); } finally { JniEnvironment.WithinNewObjectScope = false; } }
public JniMethodInfo GetCachedInstanceMethod(ref JniMethodInfo cachedMethod, string name, string signature) { AssertValid(); if (cachedMethod != null && cachedMethod.IsValid) { return(cachedMethod); } var m = GetInstanceMethod(name, signature); if (Interlocked.CompareExchange(ref cachedMethod, m, null) != null) { // No cleanup required; let the GC collect the unused instance } return(cachedMethod); }
public JniMethodInfo GetCachedStaticMethod(ref JniMethodInfo cachedMethod, string name, string signature) { AssertValid(); if (cachedMethod != null && cachedMethod.IsValid) return(cachedMethod); }
public unsafe JniObjectReference NewObject(JniMethodInfo constructor, JniArgumentValue * @parameters) { AssertValid(); return(JniEnvironment.Object.NewObject(PeerReference, constructor, parameters)); }
public JniMethodInfo GetCachedConstructor(ref JniMethodInfo cachedMethod, string signature) { AssertValid(); return(GetCachedInstanceMethod(ref cachedMethod, "<init>", signature)); }
static Types() { using (var t = new JniType("java/lang/Class")) { Class_getName = t.GetInstanceMethod("getName", "()Ljava/lang/String;"); } }
static Object() { using (var t = new JniType("java/lang/Object")) { Object_toString = t.GetInstanceMethod("toString", "()Ljava/lang/String;"); } }
public static unsafe JniObjectReference NewObject(JniObjectReference type, JniMethodInfo method, JniArgumentValue *args) { JniEnvironment.WithinNewObjectScope = true; try { return(_NewObject(type, method, args)); } finally { JniEnvironment.WithinNewObjectScope = false; } }