Share via


AbstractPreferences.GetFloat(String, Single) Method

Definition

Implements the getFloat method as per the specification in Preferences#getFloat(String,float).

[Android.Runtime.Register("getFloat", "(Ljava/lang/String;F)F", "GetGetFloat_Ljava_lang_String_FHandler")]
public override float GetFloat (string? key, float def);
[<Android.Runtime.Register("getFloat", "(Ljava/lang/String;F)F", "GetGetFloat_Ljava_lang_String_FHandler")>]
override this.GetFloat : string * single -> single

Parameters

key
String

key whose associated value is to be returned as a float.

def
Single

the value to be returned in the event that this preference node has no value associated with key or the associated value cannot be interpreted as a float.

Returns

the float value represented by the string associated with key in this preference node, or def if the associated value does not exist or cannot be interpreted as a float.

Attributes

Remarks

Implements the getFloat method as per the specification in Preferences#getFloat(String,float).

This implementation invokes #get(String,String) <tt>get(key, null)</tt>. If the return value is non-null, the implementation attempts to translate it to an float with Float#parseFloat(String). If the attempt succeeds, the return value is returned by this method. Otherwise, def is returned.

Java documentation for java.util.prefs.AbstractPreferences.getFloat(java.lang.String, float).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to