public float GetAsFloat(string key) { if (id_getAsFloat_Ljava_lang_String_ == IntPtr.Zero) id_getAsFloat_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "getAsFloat", "(Ljava/lang/String;)Ljava/lang/Float;"); IntPtr jkey = JNIEnv.NewString (key); try { using (var ret = new Java.Lang.Float (JNIEnv.CallObjectMethod (Handle, id_getAsFloat_Ljava_lang_String_, new JValue (jkey)), JniHandleOwnership.TransferLocalRef | JniHandleOwnership.DoNotRegister)) return (float) ret; } finally { JNIEnv.DeleteLocalRef (jkey); } }
public void Put(string key, float value) { if (id_put_Ljava_lang_String_Ljava_lang_Float_ == IntPtr.Zero) { id_put_Ljava_lang_String_Ljava_lang_Float_ = JNIEnv.GetMethodID(class_ref, "put", "(Ljava/lang/String;Ljava/lang/Float;)V"); } IntPtr jkey = JNIEnv.NewString(key); try { using (var val = new Java.Lang.Float(value)) JNIEnv.CallVoidMethod(Handle, id_put_Ljava_lang_String_Ljava_lang_Float_, new JValue(jkey), new JValue(val)); } finally { JNIEnv.DeleteLocalRef(jkey); } }
public float GetAsFloat(string key) { if (id_getAsFloat_Ljava_lang_String_ == IntPtr.Zero) { id_getAsFloat_Ljava_lang_String_ = JNIEnv.GetMethodID(class_ref, "getAsFloat", "(Ljava/lang/String;)Ljava/lang/Float;"); } IntPtr jkey = JNIEnv.NewString(key); try { using (var ret = new Java.Lang.Float(JNIEnv.CallObjectMethod(Handle, id_getAsFloat_Ljava_lang_String_, new JValue(jkey)), JniHandleOwnership.TransferLocalRef | JniHandleOwnership.DoNotRegister)) return((float)ret); } finally { JNIEnv.DeleteLocalRef(jkey); } }
public void Put(string key, float value) { if (id_put_Ljava_lang_String_Ljava_lang_Float_ == IntPtr.Zero) id_put_Ljava_lang_String_Ljava_lang_Float_ = JNIEnv.GetMethodID (class_ref, "put", "(Ljava/lang/String;Ljava/lang/Float;)V"); IntPtr jkey = JNIEnv.NewString (key); try { using (var val = new Java.Lang.Float (value)) JNIEnv.CallVoidMethod (Handle, id_put_Ljava_lang_String_Ljava_lang_Float_, new JValue (jkey), new JValue (val)); } finally { JNIEnv.DeleteLocalRef (jkey); } }