Partager via


JSONObject.GetLong(String) Method

Definition

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

[Android.Runtime.Register("getLong", "(Ljava/lang/String;)J", "GetGetLong_Ljava_lang_String_Handler")]
public virtual long GetLong (string name);
[<Android.Runtime.Register("getLong", "(Ljava/lang/String;)J", "GetGetLong_Ljava_lang_String_Handler")>]
abstract member GetLong : string -> int64
override this.GetLong : string -> int64

Parameters

name
String

Returns

Attributes

Exceptions

if the mapping doesn't exist or cannot be coerced to a long.

Remarks

Returns the value mapped by name if it exists and is a long or can be coerced to a long, or throws otherwise. Note that JSON represents numbers as doubles, so this is lossy; use strings to transfer numbers via JSON.

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