I need to access a variable that is inside the onSuccess method of a DocumentReference to outside query.
DocumentReference documentReference = fStore.collection("Users").document(fAuth.getUid());
documentReference.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
final String admission = documentSnapshot.getString("Admission");
}
});
From the above code, I want to get the value of variable admission from outside of documentReference.
Query query = fStore.collection("studentAboutInfo").document("1234").collection("Leave");
FirestoreRecyclerOptions<leaveStatusModalClass> options = new FirestoreRecyclerOptions.Builder<leaveStatusModalClass>()
.setQuery(query, leaveStatusModalClass.class)
.build();
I need the variables value to be used in the above query. Both are inside onCreate method.