title: can't get values out of ondatachange method
body: <p>I'm currently developing an android app where I'm using firebase as database but when in got the variable in the onDataChange method and I assign them to a global variables I got null variables but when I call those variables in the onDataChange method they are not null.</p>
  
  <pre><code>public class PositionateMarkerTask extends AsyncTask {
      public ArrayList&lt;Location&gt; arrayList= new ArrayList&lt;&gt;();
      public void connect() {
          //setting connexion parameter
          final Firebase ref = new Firebase("https://test.firebaseio.com/test");
          Query query = ref.orderByChild("longitude");
  
          //get the data from the DB
          query.addListenerForSingleValueEvent(new ValueEventListener() {
  
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  //checking if the user exist
                  if(dataSnapshot.exists()){
                      for (DataSnapshot userSnapshot : dataSnapshot.getChildren()) {
                          //get each user which has the target username
                          Location location =userSnapshot.getValue(Location.class);
                              arrayList.add(location);
                          //if the password is true , the data will be storaged in the sharedPreferences file and a Home activity will be launched
                      }
                  }
                  else{
                      System.out.println("not found");
                  }
              }
  
              @Override
              public void onCancelled(FirebaseError firebaseError) {
                    System.out.println("problem ");
  
              }
          });
      }
  
      @Override
      protected Object doInBackground(Object[] params) {
          connect();
          return null;
      }
  
      @Override
      protected void onPostExecute(Object o) {
          super.onPostExecute(o);
  
          System.out.println("the firs long is"+arrayList.get(0).getLongitude());
  
      }
  }
  </code></pre>