title: Android Firebase Recyclerview - How to deselect previous selected item?
body: <p>I have a simple question. I have a recyclerview with list items, what I can do is highlight the items you click on. My problem is that I don't know how to deselect the previous item the user has clicked on so only 1 item can be selected.</p>
  
  <pre><code>private void loadCategories() {
      adapter = new FirebaseRecyclerAdapter&lt;Category, CategoryViewHolder&gt;(
              Category.class,
              R.layout.categoryaddquestions_layout,
              CategoryViewHolder.class,
              categories
      ) {
  
          @Override
          protected void populateViewHolder(CategoryViewHolder viewHolder, final Category model, int position) {
              viewHolder.category_name.setText(model.getName());
  
  
              viewHolder.setItemClickListener(new ItemClickListener() {
                  @Override
                  public void onClick(View view, int position, boolean isLongClick) {
                      view.setSelected(false);
                  }
              });
          }
      };
      adapter.notifyDataSetChanged();
      listCategory.setAdapter(adapter);
  }
  </code></pre>
  
  <p>Here is my view holder I use </p>
  
  <pre><code>public class CategoryViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
  
      public TextView category_name;
      public ImageView category_image;
      public LinearLayout category_layout;
      private ItemClickListener itemClickListener;
      public CategoryViewHolder(View itemView) {
          super(itemView);
          category_layout = itemView.findViewById(R.id.categoryaddquestion_layout);
          category_image = itemView.findViewById(R.id.category_image);
          category_name =  itemView.findViewById(R.id.category_name);
          itemView.setOnClickListener(this);
      }
  
      public void setItemClickListener(ItemClickListener itemClickListener) {
          this.itemClickListener = itemClickListener;
      }
  
      @Override
      public void onClick(View view) {
          itemClickListener.onClick(view,getAdapterPosition(),false);
      }
  
  }
  </code></pre>