S J Sharath Krishna
S J Sharath Krishna

Reputation: 3

Not able to use getRef() of Firebase in android

I need to update the data in Firebase database. I have displayed the data in Recyclerview. I need to get the child reference of the position i click in Recyclerview. An not able to use getRef() there to get the reference.

enter image description here

Upvotes: 0

Views: 501

Answers (1)

SABANTO
SABANTO

Reputation: 1506

You need to generate a unique key with

String unique = reference.push().getKey();

when saving data to firebase, then you can use that unique key to modify content of that node later.

DatabaseReference ref = FirebaseDatabase.getInstance().getReference("Transactions").child(uniqueId)...

You can show your getRef(position) method in your question, maybe another solution can come from there.

Upvotes: 1

Related Questions