[Solved] how to handle when my jsonarray value is null in android


you can use .isNull() method to check weather the item is null or not

isNull
added in API level 1

boolean isNull (String name)

Returns true if this object has no mapping for name or if it has a mapping whose value is NULL.

sample code

if(!object.isNull("District")) {
    //District value is not null
}

1

solved how to handle when my jsonarray value is null in android