public static T StaticInvokeCall <T>(string type, string name, string sig, params object[] args) { Type t = typeof(T); IntPtr rawClass = AndroidJNI.FindClass(type); IntPtr method = AndroidJNI.GetStaticMethodID(rawClass, name, sig); jvalue[] jArgs = ConstructArgArray(args); if (t == typeof(bool)) { return((T)(object)AndroidJNI.CallStaticBooleanMethod( rawClass, method, jArgs)); } else if (t == typeof(string)) { return((T)(object)AndroidJNI.CallStaticStringMethod( rawClass, method, jArgs)); } else if (t == typeof(int)) { return((T)(object)AndroidJNI.CallStaticIntMethod( rawClass, method, jArgs)); } else if (t == typeof(float)) { return((T)(object)AndroidJNI.CallStaticFloatMethod( rawClass, method, jArgs)); } else if (t == typeof(double)) { return((T)(object)AndroidJNI.CallStaticDoubleMethod( rawClass, method, jArgs)); } else if (t == typeof(byte)) { return((T)(object)AndroidJNI.CallStaticByteMethod( rawClass, method, jArgs)); } else if (t == typeof(char)) { return((T)(object)AndroidJNI.CallStaticCharMethod( rawClass, method, jArgs)); } else if (t == typeof(long)) { return((T)(object)AndroidJNI.CallStaticLongMethod( rawClass, method, jArgs)); } else if (t == typeof(short)) { return((T)(object)AndroidJNI.CallStaticShortMethod( rawClass, method, jArgs)); } else { return(StaticInvokeObjectCall <T>(type, name, sig, args)); } }
public static double CallStaticDoubleMethod(IntPtr clazz, IntPtr methodId, jvalue[] args) { try { return(AndroidJNI.CallStaticDoubleMethod(clazz, methodId, args)); } finally { CheckException(); } }
public static T StaticInvokeCall <T>(string type, string name, string sig, params object[] args) { T local; Type type2 = typeof(T); IntPtr clazz = AndroidJNI.FindClass(type); IntPtr methodID = AndroidJNI.GetStaticMethodID(clazz, name, sig); jvalue[] jvalueArray = ConstructArgArray(args); try { if (type2 == typeof(bool)) { return((T)AndroidJNI.CallStaticBooleanMethod(clazz, methodID, jvalueArray)); } if (type2 == typeof(string)) { return((T)AndroidJNI.CallStaticStringMethod(clazz, methodID, jvalueArray)); } if (type2 == typeof(int)) { return((T)AndroidJNI.CallStaticIntMethod(clazz, methodID, jvalueArray)); } if (type2 == typeof(float)) { return((T)AndroidJNI.CallStaticFloatMethod(clazz, methodID, jvalueArray)); } if (type2 == typeof(double)) { return((T)AndroidJNI.CallStaticDoubleMethod(clazz, methodID, jvalueArray)); } if (type2 == typeof(byte)) { return((T)AndroidJNI.CallStaticByteMethod(clazz, methodID, jvalueArray)); } if (type2 == typeof(char)) { return((T)AndroidJNI.CallStaticCharMethod(clazz, methodID, jvalueArray)); } if (type2 == typeof(long)) { return((T)AndroidJNI.CallStaticLongMethod(clazz, methodID, jvalueArray)); } if (type2 == typeof(short)) { return((T)AndroidJNI.CallStaticShortMethod(clazz, methodID, jvalueArray)); } local = StaticInvokeObjectCall <T>(type, name, sig, args); } finally { AndroidJNIHelper.DeleteJNIArgArray(args, jvalueArray); } return(local); }
private double AndroidJNISafeCallStaticDoubleMethod(IntPtr clazz, IntPtr methodID, jvalue[] args) { double result; try { result = AndroidJNI.CallStaticDoubleMethod(clazz, methodID, args); } finally { AndroidJNISafeCheckException(); } return(result); }
public static T StaticInvokeCall <T>(string type, string name, string sig, params object[] args) { Type typeFromHandle = typeof(T); IntPtr intPtr = AndroidJNI.FindClass(type); IntPtr staticMethodID = AndroidJNI.GetStaticMethodID(intPtr, name, sig); jvalue[] array = ConstructArgArray(args); if (typeFromHandle == typeof(bool)) { return((T)(object)AndroidJNI.CallStaticBooleanMethod(intPtr, staticMethodID, array)); } if (typeFromHandle == typeof(string)) { return((T)(object)AndroidJNI.CallStaticStringMethod(intPtr, staticMethodID, array)); } if (typeFromHandle == typeof(int)) { return((T)(object)AndroidJNI.CallStaticIntMethod(intPtr, staticMethodID, array)); } if (typeFromHandle == typeof(float)) { return((T)(object)AndroidJNI.CallStaticFloatMethod(intPtr, staticMethodID, array)); } if (typeFromHandle == typeof(double)) { return((T)(object)AndroidJNI.CallStaticDoubleMethod(intPtr, staticMethodID, array)); } if (typeFromHandle == typeof(byte)) { return((T)(object)AndroidJNI.CallStaticByteMethod(intPtr, staticMethodID, array)); } if (typeFromHandle == typeof(char)) { return((T)(object)AndroidJNI.CallStaticCharMethod(intPtr, staticMethodID, array)); } if (typeFromHandle == typeof(long)) { return((T)(object)AndroidJNI.CallStaticLongMethod(intPtr, staticMethodID, array)); } if (typeFromHandle == typeof(short)) { return((T)(object)AndroidJNI.CallStaticShortMethod(intPtr, staticMethodID, array)); } return(StaticInvokeObjectCall <T>(type, name, sig, args)); }
public static T StaticInvokeCall <T>(string type, string name, string sig, params object[] args) { Type type1 = typeof(T); IntPtr num = AndroidJNI.FindClass(type); IntPtr staticMethodId = AndroidJNI.GetStaticMethodID(num, name, sig); jvalue[] jvalueArray = JavaObjWrapper.ConstructArgArray(args); if ((object)type1 == (object)typeof(bool)) { return((T)(ValueType)AndroidJNI.CallStaticBooleanMethod(num, staticMethodId, jvalueArray)); } if ((object)type1 == (object)typeof(string)) { return((T)AndroidJNI.CallStaticStringMethod(num, staticMethodId, jvalueArray)); } if ((object)type1 == (object)typeof(int)) { return((T)(ValueType)AndroidJNI.CallStaticIntMethod(num, staticMethodId, jvalueArray)); } if ((object)type1 == (object)typeof(float)) { return((T)(ValueType)AndroidJNI.CallStaticFloatMethod(num, staticMethodId, jvalueArray)); } if ((object)type1 == (object)typeof(double)) { return((T)(ValueType)AndroidJNI.CallStaticDoubleMethod(num, staticMethodId, jvalueArray)); } if ((object)type1 == (object)typeof(byte)) { return((T)(ValueType)AndroidJNI.CallStaticByteMethod(num, staticMethodId, jvalueArray)); } if ((object)type1 == (object)typeof(char)) { return((T)(ValueType)AndroidJNI.CallStaticCharMethod(num, staticMethodId, jvalueArray)); } if ((object)type1 == (object)typeof(long)) { return((T)(ValueType)AndroidJNI.CallStaticLongMethod(num, staticMethodId, jvalueArray)); } if ((object)type1 == (object)typeof(short)) { return((T)(ValueType)AndroidJNI.CallStaticShortMethod(num, staticMethodId, jvalueArray)); } return(JavaObjWrapper.StaticInvokeObjectCall <T>(type, name, sig, args)); }