JSONArray.OptInt Method

Definition

Overloads

OptInt(Int32)

Returns the value at index if it exists and is an int or can be coerced to an int.

OptInt(Int32, Int32)

Returns the value at index if it exists and is an int or can be coerced to an int.

OptInt(Int32)

Returns the value at index if it exists and is an int or can be coerced to an int.

[Android.Runtime.Register("optInt", "(I)I", "GetOptInt_IHandler")]
public virtual int OptInt (int index);
[<Android.Runtime.Register("optInt", "(I)I", "GetOptInt_IHandler")>]
abstract member OptInt : int -> int
override this.OptInt : int -> int

Parameters

index
Int32

Returns

Attributes

Remarks

Returns the value at index if it exists and is an int or can be coerced to an int. Returns 0 otherwise.

Java documentation for org.json.JSONArray.optInt(int).

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

OptInt(Int32, Int32)

Returns the value at index if it exists and is an int or can be coerced to an int.

[Android.Runtime.Register("optInt", "(II)I", "GetOptInt_IIHandler")]
public virtual int OptInt (int index, int fallback);
[<Android.Runtime.Register("optInt", "(II)I", "GetOptInt_IIHandler")>]
abstract member OptInt : int * int -> int
override this.OptInt : int * int -> int

Parameters

index
Int32
fallback
Int32

Returns

Attributes

Remarks

Returns the value at index if it exists and is an int or can be coerced to an int. Returns fallback otherwise.

Java documentation for org.json.JSONArray.optInt(int, int).

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