Condividi tramite


JSONObject.OptBoolean Method

Definition

Overloads

OptBoolean(String)

Returns the value mapped by name if it exists and is a boolean or can be coerced to a boolean, or false otherwise.

OptBoolean(String, Boolean)

Returns the value mapped by name if it exists and is a boolean or can be coerced to a boolean, or fallback otherwise.

OptBoolean(String)

Returns the value mapped by name if it exists and is a boolean or can be coerced to a boolean, or false otherwise.

[Android.Runtime.Register("optBoolean", "(Ljava/lang/String;)Z", "GetOptBoolean_Ljava_lang_String_Handler")]
public virtual bool OptBoolean (string? name);
[<Android.Runtime.Register("optBoolean", "(Ljava/lang/String;)Z", "GetOptBoolean_Ljava_lang_String_Handler")>]
abstract member OptBoolean : string -> bool
override this.OptBoolean : string -> bool

Parameters

name
String

Returns

Attributes

Remarks

Returns the value mapped by name if it exists and is a boolean or can be coerced to a boolean, or false otherwise.

Java documentation for org.json.JSONObject.optBoolean(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

OptBoolean(String, Boolean)

Returns the value mapped by name if it exists and is a boolean or can be coerced to a boolean, or fallback otherwise.

[Android.Runtime.Register("optBoolean", "(Ljava/lang/String;Z)Z", "GetOptBoolean_Ljava_lang_String_ZHandler")]
public virtual bool OptBoolean (string? name, bool fallback);
[<Android.Runtime.Register("optBoolean", "(Ljava/lang/String;Z)Z", "GetOptBoolean_Ljava_lang_String_ZHandler")>]
abstract member OptBoolean : string * bool -> bool
override this.OptBoolean : string * bool -> bool

Parameters

name
String
fallback
Boolean

Returns

Attributes

Remarks

Returns the value mapped by name if it exists and is a boolean or can be coerced to a boolean, or fallback otherwise.

Java documentation for org.json.JSONObject.optBoolean(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.

Applies to