protected void _SetStatic <FieldType>(string fieldName, FieldType val) { IntPtr fieldID = AndroidJNIHelper.GetFieldID <FieldType>(this.m_jclass, fieldName, true); if (AndroidReflection.IsPrimitive(typeof(FieldType))) { if (typeof(FieldType) == typeof(int)) { AndroidJNISafe.SetStaticIntField(this.m_jclass, fieldID, (int)val); } else if (typeof(FieldType) == typeof(bool)) { AndroidJNISafe.SetStaticBooleanField(this.m_jclass, fieldID, (bool)val); } else if (typeof(FieldType) == typeof(byte)) { AndroidJNISafe.SetStaticByteField(this.m_jclass, fieldID, (byte)val); } else if (typeof(FieldType) == typeof(short)) { AndroidJNISafe.SetStaticShortField(this.m_jclass, fieldID, (short)val); } else if (typeof(FieldType) == typeof(long)) { AndroidJNISafe.SetStaticLongField(this.m_jclass, fieldID, (long)val); } else if (typeof(FieldType) == typeof(float)) { AndroidJNISafe.SetStaticFloatField(this.m_jclass, fieldID, (float)val); } else if (typeof(FieldType) == typeof(double)) { AndroidJNISafe.SetStaticDoubleField(this.m_jclass, fieldID, (double)val); } else if (typeof(FieldType) == typeof(char)) { AndroidJNISafe.SetStaticCharField(this.m_jclass, fieldID, (char)val); } } else if (typeof(FieldType) == typeof(string)) { AndroidJNISafe.SetStaticStringField(this.m_jclass, fieldID, (string)val); } else if (typeof(FieldType) == typeof(AndroidJavaClass)) { AndroidJNISafe.SetStaticObjectField(this.m_jclass, fieldID, ((AndroidJavaClass)val).m_jclass); } else if (typeof(FieldType) == typeof(AndroidJavaObject)) { AndroidJNISafe.SetStaticObjectField(this.m_jclass, fieldID, ((AndroidJavaObject)val).m_jobject); } else { if (!AndroidReflection.IsAssignableFrom(typeof(Array), typeof(FieldType))) { throw new Exception("JNI: Unknown field type '" + typeof(FieldType) + "'"); } IntPtr ptr2 = AndroidJNIHelper.ConvertToJNIArray((Array)val); AndroidJNISafe.SetStaticObjectField(this.m_jclass, fieldID, ptr2); } }