title: How to get data from OnSuccessListener<QuerySnapshot>()
body: <pre><code>public class MainActivity extends AppCompatActivity {
  
  
      private static final String TAG = "100";
      FirebaseFirestore db;
  
      String checkCode;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          db= FirebaseFirestore.getInstance();
  
          db.collection("Users")
                  .whereEqualTo("level", "admin")
                  .get()
                  .addOnSuccessListener(new OnSuccessListener&lt;QuerySnapshot&gt;() {
                      @Override
                      public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
                          if (!queryDocumentSnapshots.isEmpty()) {
                              List&lt;DocumentSnapshot&gt; list = queryDocumentSnapshots.getDocuments();
                              for (DocumentSnapshot d : list) {
                                  checkCode = (String) d.get("kode");
                                  Toast.makeText(MainActivity.this, "From inside : "+checkCode, Toast.LENGTH_LONG).show();
                                  }
                              }
                          }
                      });
          Toast.makeText(MainActivity.this, "From outside : "+checkCode, Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p>I still confuse how to get data from cloud firestore.
  So i tried making a simple code to get a data from there. I put 1111 code.</p>
  
  <p>After i run the program, The toast from inside give me:</p>
  
  <pre><code>From inside : 1111 
  </code></pre>
  
  <p>But the toast from outside give me:</p>
  
  <pre><code>From outside : null
  </code></pre>
  
  <p>Why is that?
  And how i can fix it?</p>