title: Providing context to Firebase EventListener
body: <p>I have setup a value event listener in Activity's onCreate method. In that method I am logging the data to console. I opened the activity and everything works fine. But if I close the activity and change the data, It still gets called and I can see that in logs.</p>
  
  <p>So if I opened that activity say 5 times, on each update I see 5 logs messages.</p>
  
  <p>Isn't there any solution where we can provide a context of that activity so the listeners die when the activity finishes.</p>
  
  <pre><code>rootRef.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  Log.v(TAG, "Data Changed in Activity2");
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          });
  </code></pre>
  
  <p>I need to provide too many value listeners in RecyclerView also. It also causes multiple value changed event calls after it is scrolled. Because it is bind a new liestener at the existing position, and no reference to remove from the <code>onViewRecycled</code> method. So they are called multiple times and changes data randomly on screen.</p>
  
  <p>Having context makes it easier to set value event listeners. Is there way I can keep track of all the listeners? There is also no method to get the listeners for a reference.</p>