So I'm trying to calculate directions and i don't know how to retrieve latitude and longitude from firestore and the use it for starting point below, here is something that i tried. It doesn't work, it crashes, so if someone know how to save latitude and longitude from firestore and then put it in function below please help.
private void calculateDirections() {
Log.d(TAG, "calculateDirections: calculating directions.");
direction_ref_end.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
// latitude_end = (Double) documentSnapshot.getData().get("latitude");
// longitude_end = (Double) documentSnapshot.getData().get("longitude");
}
});
com.google.maps.model.LatLng destination = new com.google.maps.model.LatLng(
// latitude_end, longitude_end
);