Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain more clearly about ListAdapter #401

Open
nvmnghia opened this issue Jun 20, 2020 · 0 comments
Open

Explain more clearly about ListAdapter #401

nvmnghia opened this issue Jun 20, 2020 · 0 comments

Comments

@nvmnghia
Copy link

nvmnghia commented Jun 20, 2020

In this ListAdapter guide, the adapter has to be roughly modified like this:

public ContactsAdapter(List<Contact> 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant