Share via


AbstractPreferences.Get(String, String) Method

Definition

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

[Android.Runtime.Register("get", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", "GetGet_Ljava_lang_String_Ljava_lang_String_Handler")]
public override 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")>]
override this.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.

Attributes

Remarks

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

This implementation first checks to see if key is null throwing a NullPointerException if this is the case. Then it obtains this preference node's lock, checks that the node has not been removed, invokes #getSpi(String), and returns the result, unless the getSpi invocation returns null or throws an exception, in which case this invocation returns def.

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