Share via


AbstractPreferences.GetDouble(String, Double) Method

Definition

Implements the getDouble method as per the specification in Preferences#getDouble(String,double).

[Android.Runtime.Register("getDouble", "(Ljava/lang/String;D)D", "GetGetDouble_Ljava_lang_String_DHandler")]
public override double GetDouble (string? key, double def);
[<Android.Runtime.Register("getDouble", "(Ljava/lang/String;D)D", "GetGetDouble_Ljava_lang_String_DHandler")>]
override this.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.

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

Remarks

Implements the getDouble method as per the specification in Preferences#getDouble(String,double).

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 double with Double#parseDouble(String). If the attempt succeeds, the return value is returned by this method. Otherwise, def is returned.

Java documentation for java.util.prefs.AbstractPreferences.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