'My activity_main.xml is not showing my contacts

In my Android Studio layout file for my MainActivity class, there is a layout that used to show my contacts but it doesn't work anymore.

This is how the layout shows:

activity_main.xml

This is what shows in the emulator (note: I already have added contacts).

Outcome

I'm not sure if it has to do with the layout, the MainActivity itself or the Manifest.

The onCreate code that's suppose to show contacts below the buttons:

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recycler_view);

ContactModel dummy = new ContactModel();
dummy.setName("foo");
dummy.setNumber("123");
arrayList.add(dummy);

adapter = new MainAdapter(this, arrayList);
recyclerView.setAdapter(adapter);

Button add_btn = findViewById(R.id.add_btn);

add_btn.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, Add_Contact.class)));

Button rem_btn = findViewById(R.id.rem_btn);

rem_btn.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, Main_Remove_Contact.class)));
}

This is what my ContactModel looks like:

package com.app.wolfix;

public class ContactModel {
    String name, number;

    public String getName(){
        return name;
    }

    public void setName(String name) { this.name = name; }

    public String getNumber() { return number; }

    public void setNumber(String number) { this.number = number; }
}

Please don't hesitate to ask for any piece of code necessary, I will edit the question if necessary.

Thanks in advance!



Sources

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

Source: Stack Overflow

Solution Source