i'm trying to get Double value from json, i want to ask how to check double value is empty or not?
this is how i initial it private static
final String kartu_xcord = "xcord";
private static final String kartu_ycord = "ycord";
ouble xcord,ycord;
this is how i parse my json:
xcord = c.getDouble(kartu_xcord);
ycord = c.getDouble(kartu_ycord);
this is how i try to check xcord is null or empty :
if (xcord.isNaN()) {
LinlayNoMap.setVisibility(View.VISIBLE);
} else {
linlaymap.setVisibility(View.VISIBLE);
}
i hope someone can help me to solve my proble thank you
Java primitive types (such as int , double , or float ) cannot have null values, which you must consider in choosing your result expression and host expression types.
Sometimes you need to check if a cell is blank, generally because you might not want a formula to display a result without input. In this case we're using IF with the ISBLANK function: =IF(ISBLANK(D2),"Blank","Not Blank")
You can use the IsNullOrWhiteSpace method to test whether a string is null , its value is String. Empty, or it consists only of white-space characters.
In java double
is a primitive type which can not be null, There is Double
wrapper class in java which can be checked as null.
Declare your coords of type Double
not double
and check if Double
value is null.
In Java double
cannot be null
.
It can't be null or empty. It's a double value. Maybe try the Double wrapper?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With