Partager via


Settings.System.GetLong Method

Definition

Overloads

GetLong(ContentResolver, String)

Convenience function for retrieving a single system settings value as a long.

GetLong(ContentResolver, String, Int64)

Convenience function for retrieving a single system settings value as a long.

GetLong(ContentResolver, String)

Convenience function for retrieving a single system settings value as a long.

[Android.Runtime.Register("getLong", "(Landroid/content/ContentResolver;Ljava/lang/String;)J", "")]
public static long GetLong (Android.Content.ContentResolver? cr, string? name);
[<Android.Runtime.Register("getLong", "(Landroid/content/ContentResolver;Ljava/lang/String;)J", "")>]
static member GetLong : Android.Content.ContentResolver * string -> int64

Parameters

cr
ContentResolver

The ContentResolver to access.

name
String

The name of the setting to retrieve.

Returns

The setting's current value.

Attributes

Exceptions

Thrown if a setting by the given name can't be found or the setting value is not an integer.

Remarks

Convenience function for retrieving a single system settings value as a long. Note that internally setting values are always stored as strings; this function converts the string to a long for you.

This version does not take a default value. If the setting has not been set, or the string value is not a number, it throws SettingNotFoundException.

Java documentation for android.provider.Settings.System.getLong(android.content.ContentResolver, 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

GetLong(ContentResolver, String, Int64)

Convenience function for retrieving a single system settings value as a long.

[Android.Runtime.Register("getLong", "(Landroid/content/ContentResolver;Ljava/lang/String;J)J", "")]
public static long GetLong (Android.Content.ContentResolver? cr, string? name, long def);
[<Android.Runtime.Register("getLong", "(Landroid/content/ContentResolver;Ljava/lang/String;J)J", "")>]
static member GetLong : Android.Content.ContentResolver * string * int64 -> int64

Parameters

cr
ContentResolver

The ContentResolver to access.

name
String

The name of the setting to retrieve.

def
Int64

Value to return if the setting is not defined.

Returns

The setting's current value, or 'def' if it is not defined or not a valid long.

Attributes

Remarks

Convenience function for retrieving a single system settings value as a long. Note that internally setting values are always stored as strings; this function converts the string to a long for you. The default value will be returned if the setting is not defined or not a long.

Java documentation for android.provider.Settings.System.getLong(android.content.ContentResolver, 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