title: Retrieve String out of addValueEventListener Firebase
body: <p>I want to receive a string from <code>addValueEventListener()</code> method I use to resell the data from the database Firebase. The data arrive correctly. </p>
  
  <p>But when certain to get the string out of that method to use it in another, it returns nothing. </p>
  
  <p>You have tips? </p>
  
  <p>I already tried putExtras and also create a method on purpose but it did not work.</p>
  
  <pre><code>final DatabaseReference mPostReference = FirebaseDatabase.getInstance().getReference().child("user-daily").child(getUid()).child("2017-Year");
  mPostReference.addValueEventListener(new ValueEventListener() {
      @Override
      public void onDataChange(DataSnapshot dataSnapshot) {
          final ArrayList&lt;String&gt; labels = new ArrayList&lt;String&gt;();
          for (DataSnapshot data : dataSnapshot.getChildren()){
              final DailyItem dailyItem = data.getValue(DailyItem.class);
              labels.add(dailyItem.mese);
  
  
  
          }
          title.setText(labels.get(position));
  
          a = title.getText().toString();
      }
  
      @Override
      public void onCancelled(DatabaseError databaseError) {
          Toast.makeText(view.getContext(),"database error",
                  Toast.LENGTH_SHORT).show();
      }
  });
  
  //this return null... why?
  String title = a;
  </code></pre>