Issue
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
Solution
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.
Answered By - nsgulliver Answer Checked By - Willingham (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.