Partager via


Settings.System.GetInt Method

Definition

Overloads

GetInt(ContentResolver, String, Int32)

Convenience function for retrieving a single system settings value as an integer.

GetInt(ContentResolver, String)

Convenience function for retrieving a single system settings value as an integer.

GetInt(ContentResolver, String, Int32)

Convenience function for retrieving a single system settings value as an integer.

[Android.Runtime.Register("getInt", "(Landroid/content/ContentResolver;Ljava/lang/String;I)I", "")]
public static int GetInt (Android.Content.ContentResolver? cr, string? name, int def);
[<Android.Runtime.Register("getInt", "(Landroid/content/ContentResolver;Ljava/lang/String;I)I", "")>]
static member GetInt : Android.Content.ContentResolver * string * int -> int

Parameters

cr
ContentResolver

The ContentResolver to access.

name
String

The name of the setting to retrieve.

def
Int32

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

Attributes

Remarks

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

Java documentation for android.provider.Settings.System.getInt(android.content.ContentResolver, java.lang.String, int).

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

GetInt(ContentResolver, String)

Convenience function for retrieving a single system settings value as an integer.

[Android.Runtime.Register("getInt", "(Landroid/content/ContentResolver;Ljava/lang/String;)I", "")]
public static int GetInt (Android.Content.ContentResolver? cr, string? name);
[<Android.Runtime.Register("getInt", "(Landroid/content/ContentResolver;Ljava/lang/String;)I", "")>]
static member GetInt : Android.Content.ContentResolver * string -> int

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 an integer. Note that internally setting values are always stored as strings; this function converts the string to an integer 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.getInt(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