if(addressList.get(0).getLatitude() != null){
fullAddress += addressList.get(0).getLatitude() + " ";
}
Asked
Active
Viewed 1,479 times
0
-
Post your log cat output and Object structure of Address Item to get which data type is used for Latitude or any wrapper class. – Abhishek Jun 06 '18 at 03:13
-
Did you try `if(addressList.get(0).getLatitude() != 0){` ? – David Jun 06 '18 at 03:28
1 Answers
1
You can only compare Object types with null
Since double is a primitive and not an Object you cannot compare it with null
. Compare it with number:
if(addressList.get(0).getLatitude() != 0){
}
Where 0
is the default value of Latitude.
Check out this SO for comparing doubles properly.

Sagar
- 23,903
- 4
- 62
- 62