共用方式為


Settings.Secure.GetFloat Method

Definition

Overloads

GetFloat(ContentResolver, String)

Convenience function for retrieving a single secure settings value as a float.

GetFloat(ContentResolver, String, Single)

Convenience function for retrieving a single secure settings value as a floating point number.

GetFloat(ContentResolver, String)

Convenience function for retrieving a single secure settings value as a float.

[Android.Runtime.Register("getFloat", "(Landroid/content/ContentResolver;Ljava/lang/String;)F", "")]
public static float GetFloat (Android.Content.ContentResolver? cr, string? name);
[<Android.Runtime.Register("getFloat", "(Landroid/content/ContentResolver;Ljava/lang/String;)F", "")>]
static member GetFloat : Android.Content.ContentResolver * string -> single

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 a float.

Remarks

Convenience function for retrieving a single secure settings value as a float. Note that internally setting values are always stored as strings; this function converts the string to a float 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.Secure.getFloat(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

GetFloat(ContentResolver, String, Single)

Convenience function for retrieving a single secure settings value as a floating point number.

[Android.Runtime.Register("getFloat", "(Landroid/content/ContentResolver;Ljava/lang/String;F)F", "")]
public static float GetFloat (Android.Content.ContentResolver? cr, string? name, float def);
[<Android.Runtime.Register("getFloat", "(Landroid/content/ContentResolver;Ljava/lang/String;F)F", "")>]
static member GetFloat : Android.Content.ContentResolver * string * single -> single

Parameters

cr
ContentResolver

The ContentResolver to access.

name
String

The name of the setting to retrieve.

def
Single

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

Attributes

Remarks

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

Java documentation for android.provider.Settings.Secure.getFloat(android.content.ContentResolver, java.lang.String, float).

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