I have this code
public String getPoolValue() {
final DocumentReference docRef = database.collection("pool").document("bq2a7gLnz9bpEyIyQeNz");
docRef.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
Pool pool = documentSnapshot.toObject(Pool.class);
valueOfPool=String.valueOf(pool.getValue());
}
});
return valueOfPool;
}
And what happens, is it goes through this code, returns valueOfPool right away without going through the onSuccess block and then goes through a 2nd time and enters on the onSuccess block. Since I return the value of pool to an activity that activity never gets the actual value.