title: How can I get the Key from my Firebase Database
body: <p>I want to get the specific key every time my item in recyclerview is clicked. Everything is working fine with my code, but I can't get the child key. I just want to get the key in a form of string, but Toast result is position 0,1,2,3,4 etc, everything is working fine except getting key here</p>
  <p>Firebase database</p>
  <p><a href="https://i.stack.imgur.com/QGzt2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QGzt2.png" alt="" /></a></p>
  <p>This is my activity</p>
  <pre><code>private RecyclerView recyclerView;
  private FirebaseFirestore firebaseFirestore;
  private FirestoreRecyclerAdapter&lt;Upload, SearchListActivity.ImageViewHolder&gt; adapter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_search_list);
  
      firebaseFirestore = FirebaseFirestore.getInstance();
  
      recyclerView = findViewById(R.id.search_list_recycler_view);
      recyclerView.setHasFixedSize(true);
      recyclerView.setLayoutManager(new LinearLayoutManager(this));
  
      Query query = firebaseFirestore.collection(&quot;Dealers&quot;);
  
      FirestoreRecyclerOptions&lt;Upload&gt; options = new FirestoreRecyclerOptions.Builder&lt;Upload&gt;()
              .setQuery(query, Upload.class)
              .build();
      adapter = new FirestoreRecyclerAdapter&lt;Upload, ImageViewHolder&gt;(options) {
          @Override
          protected void onBindViewHolder(@NonNull final ImageViewHolder holder, final int position, @NonNull final Upload model) {
  
              holder.mCompanyName.setText(model.getCompanyName());
              Picasso.get().load(model.getImageUrl()).into(holder.dealerAvatar);
  
              holder.mView.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
  
                      final DatabaseReference clickedUser = FirebaseDatabase.getInstance().getReference().child(&quot;Dealers&quot;).child(String.valueOf(position));
                          clickedUser.addListenerForSingleValueEvent(new ValueEventListener() {
                              @Override
                              public void onDataChange(@NonNull DataSnapshot snapshot) {
                                  String result = clickedUser.getKey();
  
                                  Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
                              }
  
                              @Override
                              public void onCancelled(@NonNull DatabaseError error) {
  
                              }
                          });
                  }
              });
          }
  
          @NonNull
          @Override
          public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
              View view = LayoutInflater.from(parent.getContext())
                      .inflate(R.layout.listview_custom_layout, parent, false);
  
              return new ImageViewHolder(view);
          }
      };
      recyclerView.setAdapter(adapter);
  }
  
  public class ImageViewHolder extends RecyclerView.ViewHolder{
      
      public TextView mCompanyName;
      public ImageView dealerAvatar;
      public View mView;
      public ImageViewHolder(@NonNull View itemView) {
          super(itemView);
          mView = itemView;
          mCompanyName = itemView.findViewById(R.id.company_name);
          dealerAvatar = mView.findViewById(R.id.list_view_avatar);
  
      }
  }
  </code></pre>
  <p>This is my Upload.class with getter and setter</p>
  <pre><code>public class Upload {
  
  private String uid; // &lt;&lt;this will be the key, or I just need to get the key even not using this Upload.class I just need the key
  private String companyName;
  private String imageUrl;
  
  public Upload(String uid){this.uid = uid}
  
  
  public Upload(){}
  
  
  public Upload (String uid, String companyName, String imageUrl){
      this.companyName = companyName;
      this.slogan = email;
      this.companyAddress = companyAddress;
      this.imageUrl = imageUrl;
  }
  </code></pre>