Settings.Global.GetInt Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetInt(ContentResolver, String) |
Convenience function for retrieving a single secure settings value as an integer. |
GetInt(ContentResolver, String, Int32) |
Convenience function for retrieving a single secure settings value as an integer. |
GetInt(ContentResolver, String)
Convenience function for retrieving a single secure 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
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 secure 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
.
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, Int32)
Convenience function for retrieving a single secure 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
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 secure 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.
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.