I have some data in my Firestore database and I had like to use it.
MyData.get().addOnSuccessListener( new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
if (documentSnapshot.exists()){
Map<String, Object> MyData = documentSnapshot.getData();
}else {
Toast.makeText( MyActivity.this,"no document",Toast.LENGTH_SHORT ).show();
}
}
} ).addOnFailureListener( new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText( MyActivity.this,"error",Toast.LENGTH_SHORT ).show();
}
} );
Now, I had like to use MyData from outside of this listener.
I had like to send this data into some classes I have made to populate a list.
How can I do it?
Thank you