Preferences.GetDouble(String, Double) Method

Definition

Returns the double value represented by the string associated with the specified key in this preference node.

[Android.Runtime.Register("getDouble", "(Ljava/lang/String;D)D", "GetGetDouble_Ljava_lang_String_DHandler")]
public abstract double GetDouble (string? key, double def);
[<Android.Runtime.Register("getDouble", "(Ljava/lang/String;D)D", "GetGetDouble_Ljava_lang_String_DHandler")>]
abstract member GetDouble : string * double -> double

Parameters

key
String

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

def
Double

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 double, or the backing store is inaccessible.

Returns

the double 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 double.

Attributes

Exceptions

if this node has been removed.

if the parameter key is null.

Remarks

Returns the double value represented by the string associated with the specified key in this preference node. The string is converted to an integer as by Double#parseDouble(String). Returns the specified default if there is no value associated with the key, the backing store is inaccessible, or if Double.parseDouble(String) would throw a NumberFormatException if the associated value were passed. This method is intended for use in conjunction with #putDouble.

If the implementation supports stored defaults and such a default exists, is accessible, and could be converted to a double with Double.parseDouble, this double is returned in preference to the specified default.

Java documentation for java.util.prefs.Preferences.getDouble(java.lang.String, double).

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