codepath / codepath/android_guides

Explain more clearly about ListAdapter

Open
#401 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
28.3k
Forks
6.2k
PR merge metrics
No merged PRs in 30d

Description

In this [`ListAdapter` guide](https://github.com/codepath/android_guides/wiki/Using-the-RecyclerView#using-with-listadapter), the adapter has to be roughly modified like this:

```java
public ContactsAdapter(List contacts) {
super(DIFF_CALLBACK);
this.mContacts = contacts;
submitList(this.mContacts);
}
```

The guide didn't stress the importance of calling `submitList()` even in the first time `mContacts` is assigned.

I thought that `submitList()` would have to be trigger on subsequent modifications, because if it had been triggered, what would have it compare to? Turn out it does compare to `null`, and you have to `submitList()` that.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.