TypedArray.GetBoolean(Int32, 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 the boolean value for the attribute at <var>index</var>.
[Android.Runtime.Register("getBoolean", "(IZ)Z", "GetGetBoolean_IZHandler")]
public virtual bool GetBoolean (int index, bool defValue);
[<Android.Runtime.Register("getBoolean", "(IZ)Z", "GetGetBoolean_IZHandler")>]
abstract member GetBoolean : int * bool -> bool
override this.GetBoolean : int * bool -> bool
Parameters
- index
- Int32
Index of attribute to retrieve.
- defValue
- Boolean
Value to return if the attribute is not defined or cannot be coerced to an integer.
Returns
Boolean value of the attribute, or defValue if the attribute was not defined or could not be coerced to an integer.
- Attributes
Exceptions
if the TypedArray has already been recycled.
Remarks
Retrieve the boolean value for the attribute at <var>index</var>.
If the attribute is an integer value, this method returns false if the attribute is equal to zero, and true otherwise. If the attribute is not a boolean or integer value, this method will attempt to coerce it to an integer using Integer#decode(String)
and return whether it is equal to zero.
Java documentation for android.content.res.TypedArray.getBoolean(int, 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.