title: How to get document id of the postion of recycler view Item?
body: <p>I was using <code>firebaseUI</code> library to populate recycler view using <code>firestore</code> database.
  when I try to retrieve the <strong>document id</strong> when i click on recycler view item it was like this</p>
  
  <pre><code> DocumentSnapshot snapshot = getSnapshots()
                .getSnapshot(holder.getAdapterPosition());
            final String countryName = snapshot.getId();
  </code></pre>
  
  <p>I tred this code but <code>getSnapshots()</code> appears by the red colored word and nt workng inside <code>onbindeviewolder</code> so  I tried this but not working too</p>
  
  <pre><code>DocumentReference aa=firebaseFirestore.collection("MainCategories").document(String.valueOf(SS));
              String aaa=aa.getId();
  </code></pre>
  
  <p>So is there any method to retrieve the document id because the code above <strong>is not working here</strong></p>
  
  <pre><code> private class CategoriesAdapter extends RecyclerView.Adapter&lt;AllCategoriesViewHolder&gt; {
           private List&lt;mainCategroies&gt; categorylist;
  
           CategoriesAdapter(List&lt;mainCategroies&gt; categorylist) {
                this.categorylist = categorylist;
  
           }
  
           @NonNull
           @Override
           public AllCategoriesViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
                View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview_maincategory, parent, false);
                return new AllCategoriesViewHolder(view);
           }
  
           @Override
           public void onBindViewHolder(@NonNull final AllCategoriesViewHolder holder, int position) {
                final String categoryName = categorylist.get(position).getCategory_Name();
                holder.setCategory_Name(categoryName);
                String d = categorylist.get(position).getImageUrl();
                holder.setImageUrl(d);
  
                MainActivityProgress.setVisibility(View.GONE);
                holder.view.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
  
  
  
                }
                });
  
           }
  
           @Override
           public int getItemCount() {
                return categorylist.size();
           }
           }
  </code></pre>
  
  <p>the holder class</p>
  
  <p>private class AllCategoriesViewHolder extends RecyclerView.ViewHolder {
       private View view;</p>
  
  <pre><code> public AllCategoriesViewHolder(final View itemView) {
        super(itemView);
        view = itemView;
  
   }
  
   void setCategory_Name(String category_Name) {
        TextView names = view.findViewById(R.id.CategoryName);
        names.setText(category_Name);
  
   }
  
  
   void setImageUrl(String imageUrl) {
        ImageView imageView = view.findViewById(R.id.MainCat_CardViewImage);
        Picasso.get()
       .load(imageUrl)
       .fit()
       .into(imageView);
   }
   }
  </code></pre>
  
  <p>and the model class</p>
  
  <pre><code>public class CountryItem {
       private String CountryName;
  public CountryItem(){
  
  }
       public CountryItem(String countryName) {
       CountryName = countryName;
       }
  
       public String getCountryName() {
       return CountryName;
       }
  
       public void setCountryName(String countryName) {
       CountryName = countryName;
       }
  }
  </code></pre>