Q: RecyclerView is not showing anything when fetching data from firebase I am following this tutorial to dynamically fetch data from firebase and show those in a view: https://www.geeksforgeeks.org/how-to-create-dynamic-horizontal-recyclerview-in-android-using-firebase-realtime-database/
However, I can't see anything on the view, and I can't seem to figure out what is the problem.
My Adapter Class:
public class AdapterUsersRelation extends RecyclerView.Adapter<AdapterUsersRelation.ViewHolder> {
    ...
    @NonNull
    @Override
    public AdapterUsersRelation.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        // passing our layout file for displaying our users item
        return new AdapterUsersRelation.ViewHolder(LayoutInflater.from(context).inflate(R.layout.connecting_user_list, parent, false));
    }

    @Override
    public void onBindViewHolder(@NonNull AdapterUsersRelation.ViewHolder holder, int position) {
        // setting data to our views in Recycler view items.
        String user = usersRelation.reverseUserMapping(position);
        holder.textView1.setText(user);
        holder.textView2.setText(usersRelation.getUserList(user).toString());
    }

    @Override
    public int getItemCount() {
        return usersRelation.getGraphSize();
    }

    public class ViewHolder extends RecyclerView.ViewHolder{
        // creating variables for our
        // views of recycler items.
        private TextView textView1, textView2;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            // initializing the views of recycler views.
            textView1 = itemView.findViewById(R.id.textView1);
            textView2 = itemView.findViewById(R.id.textView2);
        }
    }
}

Class for communication with firebase:
public class DAOUsersRelation {
    ...
    private DAOUsersRelation() {
        FirebaseDatabase db = FirebaseDatabase.getInstance("https://doorbell-interface-default-rtdb.asia-southeast1.firebasedatabase.app/");
        databaseReference = db.getReference(UsersRelation.class.getSimpleName());
    }

    public Task<Void> add(String src, String dest) {
        StringEdge stringEdge = new StringEdge(src, dest);
        Gson gson = new Gson();
        return databaseReference.push().setValue(gson.toJson(stringEdge));
    }

    public void loadRecyclerViewData(SecondFragment secondFragment) {
        databaseReference.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                List<StringEdge> edges = new ArrayList<>();
                Log.d("shimul", String.valueOf(snapshot.getChildrenCount()));
                for (DataSnapshot dataSnapshot: snapshot.getChildren()) {
                    String str = dataSnapshot.getValue(String.class);
                    Log.d("shimul", str);
                    edges.add(new Gson().fromJson(str, StringEdge.class));
                }
                secondFragment.setUsersRelation(new UsersRelation(edges));
                secondFragment.setAdapterUsersRelation(new AdapterUsersRelation(secondFragment.getUsersRelation(),
                        secondFragment.getContext()));
                secondFragment.getAdapterUsersRelation().notifyDataSetChanged();
            }

            @Override
            public void onCancelled(@NonNull DatabaseError error) {

            }
        });
    }
}

Fragment:

    private FragmentSecondBinding binding;
    private RecyclerView recyclerView;
    private DAOUsersRelation daoUsersRelation;
    private AdapterUsersRelation adapterUsersRelation;
    private UsersRelation usersRelation;

    @Override
    public View onCreateView(
            LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState
    ) {

        binding = FragmentSecondBinding.inflate(inflater, container, false);
        return binding.getRoot();

    }

    public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        // initializing our variables
        recyclerView = binding.recyclerview;
        recyclerView.setHasFixedSize(true);// donno why

        daoUsersRelation = DAOUsersRelation.getDAOUsersRelation();

        // adding horizontal layout manager for our recycler view.
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));

        usersRelation = new UsersRelation();

        // adding our empty usersrelation to our recycler view adapter class.
        adapterUsersRelation = new AdapterUsersRelation(usersRelation, getContext());

        // setting adapter to our recycler view.
        recyclerView.setAdapter(adapterUsersRelation);

        daoUsersRelation.loadRecyclerViewData(this);

        binding.buttonSecond.setOnClickListener(new View.OnClickListener() {
        ...
        }
    }

fragment_second.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".SecondFragment">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toTopOf="@id/button_second"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="5dp"
        android:background="#fff"/>

    <Button
        android:id="@+id/button_second"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/previous"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/recyclerview" />

    <Button
        android:id="@+id/add_edge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Add New Edge"
        app:layout_constraintTop_toBottomOf="@+id/recyclerview"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        tools:layout_editor_absoluteX="301dp"
        tools:layout_editor_absoluteY="83dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

connecting_user_list.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:orientation="vertical">

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="0dp"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="16dp"
        android:layout_height="wrap_content"
        android:gravity="end"
        app:layout_constraintStart_toEndOf="@id/textView1"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

