With new firestore how do I get the key (document ID) from adapter?
With Firebase Database we get this with
String key = this.getRef(position).getKey();
Was just having the same problem. This works for me. FirestoreUI version 3.1.0.
Within your onBindViewHolder, (and note you will need to make "position" final):
String docId = getSnapshots().getSnapshot(position).getId();
Log.d("GETREFTEST", docId);
Happy coding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With