title: How to set addSnapshotListener and remove in populateViewHolder in RecyclerView Item?
body: <p>I have implemented <code>RecyclerView</code> with <strong><em>FirebaseUI-Android library</em></strong>.</p>
  
  <p>My <code>RecyclerView</code> realtime data change well once i use that <strong><code>FirebaseRecyclerAdapter</code></strong></p>
  
  <p>In Collection that data document have field type as <a href="https://firebase.google.com/docs/firestore/manage-data/data-types?authuser=0" rel="nofollow noreferrer">Boolean , Integer, Reference</a>.</p>
  
  <p>I <em>want use that Reference to get data in <code>populateViewHolder</code> with <code>addSnapshotListener</code></em>.</p>
  
  <p>Help me! Here is my code:</p>
  
  <pre><code>         FirebaseRecyclerAdapter&lt;Conv, ConvViewHolder&gt; firebaseConvAdapter = new FirebaseRecyclerAdapter&lt;Conv, ConvViewHolder&gt;(
              Conv.class,
              R.layout.users_single_layout,
              ConvViewHolder.class,
              conversationQuery
      ) {
          @Override
          protected void populateViewHolder(final ConvViewHolder convViewHolder, final Conv conv, int i) {
  
              final String list_user_id = getRef(i).getKey();
  
              final DocumentReference docRef = db.collection("cities").document(list_user_id);
              docRef.addSnapshotListener(new EventListener&lt;DocumentSnapshot&gt;() {
                  @Override
                  public void onEvent(@Nullable DocumentSnapshot snapshot,
                                      @Nullable FirebaseFirestoreException e) {
                      if (e != null) {
                          Log.w(TAG, "Listen failed.", e);
                          return;
                      }
  
                      if (snapshot != null &amp;&amp; snapshot.exists()) {
                          Log.d(TAG, "Current data: " + snapshot.getData());
                      } else {
                          Log.d(TAG, "Current data: null");
                      }
                  }
              });
          }
      };
  
      mConvList.setAdapter(firebaseConvAdapter);
  </code></pre>
  
  <p>Firebase saying if you add addSnapshotListener then must to remove it once no need for that <a href="https://firebase.google.com/docs/firestore/query-data/listen?authuser=0" rel="nofollow noreferrer">Detach a listener</a></p>
  
  <blockquote>
    <p>When you are no longer interested in listening to your data, you must detach your listener so that your event callbacks stop getting called. This allows the client to stop using bandwidth to receive updates. You can use the unsubscribe function on <code>onSnapshot()</code> to stop listening to updates.</p>
  </blockquote>