As you can see from the picture I have a child FreezerItems
, and under that child I have two other childs which are randomKeys that Firebase has created by using push()
. My question is, how do I specifically get the key L8i2M4wNUF5wOojaFE
. Also how do I get that key into my RecyclerViewAdapter
. I have tried this:
holder.mDeleteBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mDatabase = FirebaseDatabase.getInstance().getReference().child("FreezerItems");
String key = mDatabase.push().getKey();
Toast.makeText(view.getContext(), key, Toast.LENGTH_SHORT).show();
}
});
But all that ever did was show a Toast with a random key, that changes each time I click on the button