title: How to get data outside addonsuccesslistner in it in android Studio. My app is getting money if i put it in but while i put outside it shows empty
body: <pre><code> .addOnSuccessListener(new OnSuccessListener&lt;DocumentSnapshot&gt;() {
                      @Override
                      public void onSuccess(DocumentSnapshot documentSnapshot) {
                         MyVariable = documentSnapshot.get(&quot;money&quot;).toString();
                          textView1.setText(MyVariable);
                      }
                  });
  </code></pre>
  <p>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</p>