Skip to content

Explain more clearly about ListAdapter #401

Open

Description

@nvmnghia

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions