GetStaticByteField() public static method

public static GetStaticByteField ( IntPtr clazz, IntPtr fieldID ) : byte
clazz System.IntPtr
fieldID System.IntPtr
return byte
Exemplo n.º 1
0
        protected FieldType _GetStatic <FieldType>(string fieldName)
        {
            IntPtr fieldID = AndroidJNIHelper.GetFieldID <FieldType>(this.m_jclass, fieldName, true);

            if (AndroidReflection.IsPrimitive(typeof(FieldType)))
            {
                if (typeof(FieldType) == typeof(int))
                {
                    return((FieldType)AndroidJNISafe.GetStaticIntField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(bool))
                {
                    return((FieldType)AndroidJNISafe.GetStaticBooleanField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(byte))
                {
                    return((FieldType)AndroidJNISafe.GetStaticByteField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(short))
                {
                    return((FieldType)AndroidJNISafe.GetStaticShortField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(long))
                {
                    return((FieldType)AndroidJNISafe.GetStaticLongField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(float))
                {
                    return((FieldType)AndroidJNISafe.GetStaticFloatField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(double))
                {
                    return((FieldType)AndroidJNISafe.GetStaticDoubleField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(char))
                {
                    return((FieldType)AndroidJNISafe.GetStaticCharField(this.m_jclass, fieldID));
                }
                return(default(FieldType));
            }
            if (typeof(FieldType) == typeof(string))
            {
                return((FieldType)AndroidJNISafe.GetStaticStringField(this.m_jclass, fieldID));
            }
            if (typeof(FieldType) == typeof(AndroidJavaClass))
            {
                return((FieldType)AndroidJavaClassDeleteLocalRef(AndroidJNISafe.GetStaticObjectField(this.m_jclass, fieldID)));
            }
            if (typeof(FieldType) == typeof(AndroidJavaObject))
            {
                return((FieldType)AndroidJavaObjectDeleteLocalRef(AndroidJNISafe.GetStaticObjectField(this.m_jclass, fieldID)));
            }
            if (!AndroidReflection.IsAssignableFrom(typeof(Array), typeof(FieldType)))
            {
                throw new Exception("JNI: Unknown field type '" + typeof(FieldType) + "'");
            }
            return(AndroidJNIHelper.ConvertFromJNIArray <FieldType>(AndroidJNISafe.GetStaticObjectField(this.m_jclass, fieldID)));
        }