ISharedPreferences.GetBoolean(String, Boolean) 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.
Retrieve a boolean value from the preferences.
[Android.Runtime.Register("getBoolean", "(Ljava/lang/String;Z)Z", "GetGetBoolean_Ljava_lang_String_ZHandler:Android.Content.ISharedPreferencesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool GetBoolean (string? key, bool defValue);
[<Android.Runtime.Register("getBoolean", "(Ljava/lang/String;Z)Z", "GetGetBoolean_Ljava_lang_String_ZHandler:Android.Content.ISharedPreferencesInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetBoolean : string * bool -> bool
Parameters
- key
- String
The name of the preference to retrieve.
- defValue
- Boolean
Value to return if this preference does not exist.
Returns
Returns the preference value if it exists, or defValue. Throws ClassCastException if there is a preference with this name that is not a boolean.
- Attributes
Exceptions
Remarks
Retrieve a boolean value from the preferences.
Java documentation for android.content.SharedPreferences.getBoolean(java.lang.String, boolean)
.
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.