Boolean Class

Definition

The Boolean class wraps a value of the primitive type boolean in an object.

[Android.Runtime.Register("java/lang/Boolean", DoNotGenerateAcw=true)]
public sealed class Boolean : Java.Lang.Object, IConvertible, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable, Java.Lang.IComparable
[<Android.Runtime.Register("java/lang/Boolean", DoNotGenerateAcw=true)>]
type Boolean = class
    inherit Object
    interface IConvertible
    interface ISerializable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface IComparable
Inheritance
Boolean
Attributes
Implements

Remarks

The Boolean class wraps a value of the primitive type boolean in an object. An object of type Boolean contains a single field whose type is boolean.

In addition, this class provides many methods for converting a boolean to a String and a String to a boolean, as well as other constants and methods useful when dealing with a boolean.

<!-- Android-removed: paragraph on ValueBased

This is a value-based class; programmers should treat instances that are #equals(Object) equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail. -->

Added in 1.0.

Java documentation for java.lang.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.

Constructors

Name Description
Boolean(Boolean)

Allocates a Boolean object representing the value argument.

Boolean(String)

Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true".

Properties

Name Description
Class

Returns the runtime class of this Object.

(Inherited from Object)
False

The Boolean object corresponding to the primitive value false.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode

Gets the identity hash code assigned to this Java peer by the interop runtime.

(Inherited from Object)
JniPeerMembers

Gets the JNI metadata used to invoke members of this Java peer.

PeerReference

Gets the JNI object reference for this Java peer.

(Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
True

The Boolean object corresponding to the primitive value true.

Type

The Class object representing the primitive type boolean.

Methods

Name Description
BooleanValue()

Returns the value of this Boolean object as a boolean primitive.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Compare(Boolean, Boolean)

Compares two boolean values.

CompareTo(Boolean)

Compares this Boolean instance with another.

Dispose()

Releases the resources held by this Java peer.

(Inherited from Object)
Dispose(Boolean)

Releases the resources held by this Java peer.

(Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetBoolean(String)

Returns true if and only if the system property named by the argument exists and is equal to, ignoring case, the string "true".

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
HashCode(Boolean)

Returns a hash code for a boolean value; compatible with Boolean.hashCode().

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
LogicalAnd(Boolean, Boolean)

Returns the result of applying the logical AND operator to the specified boolean operands.

LogicalOr(Boolean, Boolean)

Returns the result of applying the logical OR operator to the specified boolean operands.

LogicalXor(Boolean, Boolean)

Returns the result of applying the logical XOR operator to the specified boolean operands.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
ParseBoolean(String)

Parses the string argument as a boolean.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>()

Creates a managed array from this Java array wrapper.

(Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
ToString(Boolean)

Returns a String object representing the specified boolean.

UnregisterFromRuntime()

Unregisters this Java peer from the interop runtime.

(Inherited from Object)
ValueOf(Boolean)

Returns a Boolean instance representing the specified boolean value.

ValueOf(String)

Returns a Boolean with a value represented by the specified string.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Operators

Name Description
Explicit(Boolean to Boolean)

Converts the specified Boolean value to Boolean.

Explicit Interface Implementations

Name Description
IComparable.CompareTo(Object)

Compares this value with the specified object for ordering.

IConvertible.GetTypeCode()

Returns the type code for this value.

IConvertible.ToBoolean(IFormatProvider)

Converts this value to Boolean.

IConvertible.ToByte(IFormatProvider)

Converts this value to Byte.

IConvertible.ToChar(IFormatProvider)

Conversion to Char is unsupported and throws InvalidCastException.

IConvertible.ToDateTime(IFormatProvider)

Conversion to DateTime is unsupported and throws InvalidCastException.

IConvertible.ToDecimal(IFormatProvider)

Converts this value to Decimal.

IConvertible.ToDouble(IFormatProvider)

Converts this value to Double.

IConvertible.ToInt16(IFormatProvider)

Converts this value to Int16.

IConvertible.ToInt32(IFormatProvider)

Converts this value to Int32.

IConvertible.ToInt64(IFormatProvider)

Converts this value to Int64.

IConvertible.ToSByte(IFormatProvider)

Converts this value to SByte.

IConvertible.ToSingle(IFormatProvider)

Converts this value to Single.

IConvertible.ToString(IFormatProvider)

Converts this value to String.

IConvertible.ToType(Type, IFormatProvider)

Converts this value to the type specified by conversionType.

IConvertible.ToUInt16(IFormatProvider)

Converts this value to UInt16.

IConvertible.ToUInt32(IFormatProvider)

Converts this value to UInt32.

IConvertible.ToUInt64(IFormatProvider)

Converts this value to UInt64.

IJavaPeerable.Disposed()

Notifies the interop runtime that this managed peer has been disposed.

(Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced()

Releases this Java peer unless it is retained by another managed reference.

(Inherited from Object)
IJavaPeerable.Finalized()

Notifies the interop runtime that this managed peer has been finalized.

(Inherited from Object)
IJavaPeerable.JniManagedPeerState

Gets the state that describes the relationship between this managed peer and its JNI reference.

(Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32)

Sets the interop identity hash code for this Java peer.

(Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates)

Sets the managed and JNI peer state for this Java peer.

(Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference)

Sets the JNI object reference used by this managed peer.

(Inherited from Object)

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to