Preferences.Get(String, String) Method

Definition

Returns the value associated with the specified key in this preference node.

[Android.Runtime.Register("get", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", "GetGet_Ljava_lang_String_Ljava_lang_String_Handler")]
public abstract string? Get (string? key, string? def);
[<Android.Runtime.Register("get", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", "GetGet_Ljava_lang_String_Ljava_lang_String_Handler")>]
abstract member Get : string * string -> string

Parameters

key
String

key whose associated value is to be returned.

def
String

the value to be returned in the event that this preference node has no value associated with key.

Returns

the value associated with key, or def if no value is associated with key, or the backing store is inaccessible.

Attributes

Exceptions

if this node has been removed.

if the parameter key is null.

Remarks

Returns the value associated with the specified key in this preference node. Returns the specified default if there is no value associated with the key, or the backing store is inaccessible.

Some implementations may store default values in their backing stores. If there is no value associated with the specified key but there is such a stored default, it is returned in preference to the specified default.

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

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