getRef(position).getKey() doesnt work in onMyBindViewHolder

Viewed 33

hello i got a firebase databsae and i am trying to get the keys

this is the varibales i got in myAdapter

Context context;
public ArrayList<User> list;

and this is the code in the button i have;

@Override
                public void onClick(View v) {
                    EditText year= view.findViewById(R.id.enterYear);
                    EditText month=view.findViewById(R.id.enterMonth);
                    String place=user.getWorkPlaceCase();


                    Map<String,Object> map = new HashMap<>();
                    map.put("address",workerFirstName.getText().toString());

                    FirebaseDatabase.getInstance().getReference().child("place").child("2022").child("אוגוסט").child(getRef(position).getKey()).updateChildren(map);


                }

but the fourth child is suppsoed to be one of the keys but getRef(position).getKey() is not defiend.

any solutions?

0 Answers
Related