Sdílet prostřednictvím


ISharedPreferences.GetFloat(String, Single) Method

Definition

Retrieve a float value from the preferences.

[Android.Runtime.Register("getFloat", "(Ljava/lang/String;F)F", "GetGetFloat_Ljava_lang_String_FHandler:Android.Content.ISharedPreferencesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public float GetFloat (string? key, float defValue);
[<Android.Runtime.Register("getFloat", "(Ljava/lang/String;F)F", "GetGetFloat_Ljava_lang_String_FHandler:Android.Content.ISharedPreferencesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetFloat : string * single -> single

Parameters

key
String

The name of the preference to retrieve.

defValue
Single

Value to return if this preference does not exist.

Returns

Returns the preference value if it exists, or defValue. Throws ClassCastException if there is a preference with this name that is not a float.

Attributes

Exceptions

Remarks

Retrieve a float value from the preferences.

Java documentation for android.content.SharedPreferences.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