UnityEngine.AndroidJNIHelper.ConvertToJNIArray C# (CSharp) Method

ConvertToJNIArray() public static method

public static ConvertToJNIArray ( Array array ) : IntPtr
array Array
return IntPtr
		public static IntPtr ConvertToJNIArray(Array array){}
		public static jvalue[] CreateJNIArgArray(Object[] args){}

Usage Example

コード例 #1
0
        protected void _Set <FieldType>(string fieldName, FieldType val)
        {
            IntPtr fieldId = AndroidJNIHelper.GetFieldID <FieldType>(this.m_jclass, fieldName, false);

            if (AndroidReflection.IsPrimitive(typeof(FieldType)))
            {
                if (typeof(FieldType) == typeof(int))
                {
                    AndroidJNISafe.SetIntField(this.m_jobject, fieldId, (int)(object)val);
                }
                else if (typeof(FieldType) == typeof(bool))
                {
                    AndroidJNISafe.SetBooleanField(this.m_jobject, fieldId, (bool)(object)val);
                }
                else if (typeof(FieldType) == typeof(byte))
                {
                    AndroidJNISafe.SetByteField(this.m_jobject, fieldId, (byte)(object)val);
                }
                else if (typeof(FieldType) == typeof(short))
                {
                    AndroidJNISafe.SetShortField(this.m_jobject, fieldId, (short)(object)val);
                }
                else if (typeof(FieldType) == typeof(long))
                {
                    AndroidJNISafe.SetLongField(this.m_jobject, fieldId, (long)(object)val);
                }
                else if (typeof(FieldType) == typeof(float))
                {
                    AndroidJNISafe.SetFloatField(this.m_jobject, fieldId, (float)(object)val);
                }
                else if (typeof(FieldType) == typeof(double))
                {
                    AndroidJNISafe.SetDoubleField(this.m_jobject, fieldId, (double)(object)val);
                }
                else
                {
                    if (typeof(FieldType) != typeof(char))
                    {
                        return;
                    }
                    AndroidJNISafe.SetCharField(this.m_jobject, fieldId, (char)(object)val);
                }
            }
            else if (typeof(FieldType) == typeof(string))
            {
                AndroidJNISafe.SetStringField(this.m_jobject, fieldId, (string)(object)val);
            }
            else if (typeof(FieldType) == typeof(AndroidJavaClass))
            {
                AndroidJNISafe.SetObjectField(this.m_jobject, fieldId, ((AndroidJavaObject)(object)val).m_jclass);
            }
            else if (typeof(FieldType) == typeof(AndroidJavaObject))
            {
                AndroidJNISafe.SetObjectField(this.m_jobject, fieldId, ((AndroidJavaObject)(object)val).m_jobject);
            }
            else
            {
                if (!AndroidReflection.IsAssignableFrom(typeof(Array), typeof(FieldType)))
                {
                    throw new Exception("JNI: Unknown field type '" + (object)typeof(FieldType) + "'");
                }
                IntPtr jniArray = AndroidJNIHelper.ConvertToJNIArray((Array)(object)val);
                AndroidJNISafe.SetObjectField(this.m_jclass, fieldId, jniArray);
            }
        }
All Usage Examples Of UnityEngine.AndroidJNIHelper::ConvertToJNIArray