title: Getting firebase reference out of SingleValueEventListener
body: <p>I am using <code>SingleValueEventListener</code> to get some data from Firebase Database. Having acquired the data, I need to get another Firebase database reference using that data. Later, I need to use the second/new Firebase database ref inside different method. </p>
  
  <p>When I use this second reference, I am getting null object reference exception. 
  Here is the code. It is from onCreate(): </p>
  
  <pre><code> mCurrentUserDatabase.addListenerForSingleValueEvent(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              String university = dataSnapshot.child("university").getValue().toString();
              String groupid = dataSnapshot.child("groupid").getValue().toString();
              //Having acquired university and group ID, now we can get reference to group members list
              mMembersDatabase = FirebaseDatabase.getInstance().getReference().child("Universities").child(university).child("Groups").child(groupid).child("Members");
  </code></pre>
  
  <p>And, I need to use this mMembersDatabase again in onStart() method. How can i do this? Please dont suggest to get the ref inside onStart(). I need to know how can i pass the ref from one method to another method. </p>