Partager via


AbstractPreferences.GetLong(String, Int64) Method

Definition

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

[Android.Runtime.Register("getLong", "(Ljava/lang/String;J)J", "GetGetLong_Ljava_lang_String_JHandler")]
public override long GetLong (string? key, long def);
[<Android.Runtime.Register("getLong", "(Ljava/lang/String;J)J", "GetGetLong_Ljava_lang_String_JHandler")>]
override this.GetLong : string * int64 -> int64

Parameters

key
String

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

def
Int64

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 long.

Returns

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

Attributes

Remarks

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

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

Java documentation for java.util.prefs.AbstractPreferences.getLong(java.lang.String, long).

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