title: Remove item from populateViewHolder in firebaseRecyclerAdapter
body: <p>I am trying to remove item from firebaseRecyelerAdapter in populateViewHolder method. I am using <strong>item.setVisibility(view.GONE)</strong> but that again shows value when come back in that fragment.
   here is my code:</p>
  
  <pre><code>public class ChatsFragment extends Fragment {
  
  private RecyclerView mConvList;
  
  private DatabaseReference mConvDatabase;
  private DatabaseReference mMessageDatabase;
  private DatabaseReference mUsersDatabase;
  
  private FirebaseAuth mAuth;
  
  private String mCurrent_user_id;
  
  private View mMainView;
  private ProgressDialog pd;
  
  
  public ChatsFragment() {
      // Required empty public constructor
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
  
      mMainView = inflater.inflate(R.layout.fragment_chats, container, false);
  
      mConvList = (RecyclerView) mMainView.findViewById(R.id.conv_list);
      mAuth = FirebaseAuth.getInstance();
  
      mCurrent_user_id = mAuth.getCurrentUser().getUid();
  
      mConvDatabase = FirebaseDatabase.getInstance().getReference().child("Chat").child(mCurrent_user_id);
  
      mConvDatabase.keepSynced(true);
      mUsersDatabase = FirebaseDatabase.getInstance().getReference().child("Users");
      mMessageDatabase = FirebaseDatabase.getInstance().getReference().child("messages").child(mCurrent_user_id);
      mUsersDatabase.keepSynced(true);
  
      LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
      linearLayoutManager.setReverseLayout(true);
      linearLayoutManager.setStackFromEnd(true);
  
      mConvList.setHasFixedSize(true);
      mConvList.setLayoutManager(linearLayoutManager);
  
  
      // Inflate the layout for this fragment
      return mMainView;
  }
  
  
  @Override
  public void onStart() {
      super.onStart();
  
      Query conversationQuery = mConvDatabase.orderByChild("timestamp");
  
      final 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, final int i) {
  
              final String list_user_id = getRef(i).getKey();
  
              Query lastMessageQuery = mMessageDatabase.child(list_user_id).limitToLast(1);
  
              lastMessageQuery.addChildEventListener(new ChildEventListener() {
                  @Override
                  public void onChildAdded(DataSnapshot dataSnapshot, String s) {
  
                      String data = dataSnapshot.child("message").getValue().toString();
                      convViewHolder.setMessage(data, conv.isSeen());
  
                  }
  
                  @Override
                  public void onChildChanged(DataSnapshot dataSnapshot, String s) {
  
                  }
  
                  @Override
                  public void onChildRemoved(DataSnapshot dataSnapshot) {
  
                  }
  
                  @Override
                  public void onChildMoved(DataSnapshot dataSnapshot, String s) {
  
                  }
  
                  @Override
                  public void onCancelled(DatabaseError databaseError) {
  
                  }
              });
  
  
              mUsersDatabase.child(list_user_id).addValueEventListener(new ValueEventListener() {
                  @Override
                  public void onDataChange(DataSnapshot dataSnapshot) {
  
                      final String userName = dataSnapshot.child("name").getValue().toString();
                      String userThumb = dataSnapshot.child("thumb_image").getValue().toString();
  
                      if(dataSnapshot.hasChild("online")) {
  
                          String userOnline = dataSnapshot.child("online").getValue().toString();
                          convViewHolder.setUserOnline(userOnline);
  
                      }
  
                      convViewHolder.setName(userName);
                      convViewHolder.setUserImage(userThumb, getContext());
  
                      convViewHolder.mView.setOnClickListener(new View.OnClickListener() {
                          @Override
                          public void onClick(View view) {
  
  
                              Intent chatIntent = new Intent(getContext(), ChatActivity.class);
                              chatIntent.putExtra("user_id", list_user_id);
                              chatIntent.putExtra("user_name", userName);
                              startActivity(chatIntent);
  
                          }
                      });
  
                      convViewHolder.mView.setOnLongClickListener(new View.OnLongClickListener() {
                          @Override
                          public boolean onLongClick(View view) {
                              Toast.makeText(getContext(), "long clicked", Toast.LENGTH_SHORT).show();
                          firebaseConvAdapter.getRef(i).removeValue()
                                  .addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
                                      @Override
                                      public void onComplete(@NonNull Task&lt;Void&gt; task) {
                                          Toast.makeText(getContext(), "deleted", Toast.LENGTH_SHORT).show();
                                      }
                                  });
                              return false;
  
                          }
                      });
  
  
                  }
  
                  @Override
                  public void onCancelled(DatabaseError databaseError) {
  
                  }
              });
  
          }
      };
  
      mConvList.setAdapter(firebaseConvAdapter);
  
  }
  
  public static class ConvViewHolder extends RecyclerView.ViewHolder {
  Context context;
      View mView;
  
      public ConvViewHolder(View itemView) {
          super(itemView);
  
          mView = itemView;
  
  
  
      }
            public void setMessage(String message, boolean isSeen){
  
          TextView userStatusView = (TextView) mView.findViewById(R.id.user_single_status);
          userStatusView.setText(message);
  
          if(!isSeen){
              userStatusView.setTypeface(userStatusView.getTypeface(), Typeface.BOLD);
          } else {
              userStatusView.setTypeface(userStatusView.getTypeface(), Typeface.NORMAL);
          }
  
      }
  
      public void setName(String name){
  
          TextView userNameView = (TextView) mView.findViewById(R.id.user_single_name);
          userNameView.setText(name);
  
      }
  
      public void setUserImage(String thumb_image, Context ctx){
  
          CircleImageView userImageView = (CircleImageView) mView.findViewById(R.id.user_single_image);
          Picasso.with(ctx).load(thumb_image).placeholder(R.mipmap.default_image).into(userImageView);
  
      }
  
      public void setUserOnline(String online_status) {
  
          ImageView userOnlineView = (ImageView) mView.findViewById(R.id.user_single_online_icon);
  
          if(online_status.equals("true")){
  
              userOnlineView.setVisibility(View.VISIBLE);
  
          } else {
  
              userOnlineView.setVisibility(View.INVISIBLE);
          }
      } }}
  </code></pre>
  
  <p>I am trying to remove the value on <strong>LongClicked</strong> method.thanks.
  I also tried to used item.remove() method but that is not <strong>remove()</strong> method is not recogninzing in this method.  Please help me </p>