'Is there any way to retrieve all data to the firebase Recycler Adapter, edit it then write it to another database?

I am working on an attendance app. Basically, I have already made the database of all the info needed and I can retrieve it to the firebase adapter. However, every time I tried to set the value on the attendance and send it to the other database it will only show one data.

Record show's only Mark (no John): Record show's only Mark (no John)

This is the attendance radio button

   optionAttendanceData = new FirebaseRecyclerOptions.Builder<AttendanceCustom>()
    .setQuery(mQueryAttendanceData, AttendanceCustom.class).build();

    firebaseRecyclerAdapterAttendanceData = new FirebaseRecyclerAdapter<AttendanceCustom, AttendanceDataCustomViewHolder>(optionAttendanceData) {
        @Override
        protected void onBindViewHolder(@NonNull AttendanceDataCustomViewHolder holder, int position, @NonNull AttendanceCustom model) {
            
            holder.setDetails(model.getFirstName(), model.getLastName());
            firstName = model.getFirstName();
            lastName = model.getLastName();
            attendance = model.getAttendance();
            description = model.getDesctiption();
            date = model.getDate();
            
        }

        @NonNull
        @Override
        public AttendanceDataCustomViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
            mViewAttendanceData = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_attendance_data, parent, false);
            return new AttendanceDataCustomViewHolder(mViewAttendanceData);
        }
    };

    mRecyclerViewAttendanceData.setAdapter(firebaseRecyclerAdapterAttendanceData);
    firebaseRecyclerAdapterAttendanceData.startListening();
    firebaseRecyclerAdapterAttendanceData.notifyDataSetChanged();    
}

public class AttendanceDataCustomViewHolder extends RecyclerView.ViewHolder {

    public AttendanceDataCustomViewHolder(View itemView) {
        super(itemView);
        mViewAttendanceData = itemView;            
    }

    private void setDetails(String first, String last) {
        TextView tv_first = mViewAttendanceData.findViewById(R.id.tv_attendance_data_first_name);
        TextView tv_last = mViewAttendanceData.findViewById(R.id.tv_attendance_data_last_name);

        tv_first.setText(first);
        tv_last.setText(last);
        radioButtonAttendance();    
    }

    public void sendData(){
        randomNumber = random.nextInt(10000);
        DatabaseReference dataRefAttendance = FirebaseDatabase.getInstance().getReference("Attendance").child("Record");
        AttendanceCustom attendanceCustom = new AttendanceCustom(firstName, lastName, date, description, attendance, numberDate);
        newKey = dataRefAttendance.child("Attendance").child("record").push().getKey();
        dataRefAttendance.child(firstName + "-" + lastName + "-" + randomNumber).setValue(attendanceCustom);
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source