I am getting an error on this code below:
HashMap map = new HashMap();
map.put("driver", userId);
map.put("customer", customerId);
map.put("rating", 0);
map.put("timestamp", getCurrentTimestamp());
map.put("destination", destination);
map.put("location/from/lat", pickupLatLng.latitude);
map.put("location/from/lng", pickupLatLng.longitude);
map.put("location/to/lat", destinationLatLng.latitude);
map.put("location/to/lng", destinationLatLng.longitude);
map.put("distance", rideDistance);
historyRef.child(requestId).updateChildren(map);
They said to add:
do if( pickupLatLng.latitude != null && pickupLatLng.longitude != null && destinationLatLng.latitude != null && destinationLatLng.longitude != null) before creating the hashMap, or for each latitude and longitude.
But when i try this i am getting the following error: operator != cannot be applied to double, null
Can someone help me please ?
double is a primitive type, it cannot be null, instead you can use Double and then compare it to null
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