title: Cannot get data in the variable when firebase Firestore is called using methord return value
body: <p>When I get data from Cloud Firestore in android. It returns an empty variable. It should return the value of the flag true or false.</p>
  
  <pre><code>public boolean checkIfUserAlreadyExists(final String email) {
          final boolean[] flag = {false};
          db.collection(context.getString(R.string.db_collection_users))
                  .get()
                  .addOnCompleteListener(new OnCompleteListener&lt;QuerySnapshot&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;QuerySnapshot&gt; task) {
                          if (task.isSuccessful()) {
                              for (QueryDocumentSnapshot document : task.getResult()) {
                                  if (document.getData().get(context.getString(R.string.db_field_email)).toString() != null &amp;&amp; document.getData().get(context.getString(R.string.db_field_email)).toString().equals(email)) {
                                      Toast.makeText(context, "User Already exits", Toast.LENGTH_SHORT);
                                      Log.e(TAG, "User already exists" + document.getData().get("email").toString());
                                      flag[0] = true;
                                  } else {
                                      Log.e(TAG, "User do not exists");
                                  }
                              }
                          } else {
                              Log.e(TAG, "Error getting documents.", task.getException());
                          }
                      }
                  });
          return flag[0];
      }
  </code></pre>
  
  <p>flag[0] should return true but it returns false when called in another activity.</p>