0
 .addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
                    @Override
                    public void onSuccess(DocumentSnapshot documentSnapshot) {
                       MyVariable = documentSnapshot.get("money").toString();
                        textView1.setText(MyVariable);
                    }
                });

I want to take the Myvariable data outside of onSuccess, Please help please, I didn't find the Statisfied and Working idea in entrie Stackoverflow

  • The problem is not **where** you access the value, but **when** you access it. If you need `money1` outside of `onSuccess`, you'll need to make sure that code only executes *after* `onSuccess` has completed. See https://stackoverflow.com/questions/51000169/how-to-check-a-certain-data-already-exists-in-firestore-or-not/51002413#51002413 and more of the questions I linked. – Frank van Puffelen Mar 12 '22 at 16:57
  • No that doesn't resolve – Subash Bhandari Mar 13 '22 at 07:54
  • 1
    It's going to be hard to help you further with just that. If you think your question is different from the ones I linked, please explain why that is. Otherwise, if you tried to solve your problem with the information from the links, edit your question to show what you tried from there already. – Frank van Puffelen Mar 13 '22 at 15:16

0 Answers0