title: Firebase load data onCreate()
body: <p>I want to load a dataset oncreate().</p>
  
  <p>Since the data will not change, I use the one time loader:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      ....
  
      mDatabase.child("users").child(userId).addListenerForSingleValueEvent(
          new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  currentUser = dataSnapshot.getValue(Users.class);
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
                  Log.w(TAG, "error:", databaseError.toException());
              }
      });
      String name = currentUser.getName();
      ....
  }
  </code></pre>
  
  <p>But the data is not available, the getName function is called on a null object.</p>
  
  <p>How can I get the data onCreate()?</p>