Skip to content Skip to sidebar Skip to footer

Empty Recyclerview When Using Custom Adapter

I am trying to populate my RecyclerView with data from cloud(parse.com). However, The end result is an Empty RecyclerView . Though I am able to retrieve the data from cloud, I don'

Solution 1:

The problem is, you are not actually setting the data into the adapter. First off add the following method inside of your adapter :

publicvoidsetPersons(List<Person> persons){
        this.persons = persons;
        notifyDataSetChanged();
    }

Then after the initializeData() method in your calling class just call adapter.setPersons(persons). You don't have to call the following again:

`privatevoidinitializeAdapter(){

    rv.setAdapter(adapter);
}`

So basically just call adapter.setPersons(persons) whenever you get new data from the server.

Post a Comment for "Empty Recyclerview When Using Custom Adapter"