Skip to content

5.x | Update Data Set

Davide Steduto edited this page Jul 22, 2016 · 21 revisions

To update the entire data set the method updateDataSet has two modality:

1. Instant refresh, but no synchronization animations. It Skips all notifyItemXXX() calls and just before calling notifyDataSetChanged(), the adapter list is integrated with expandables expanded and headers to be shown.

updateDataSet(new_items*);
updateDataSet(new_items*, false);

2. Asynchronous update, to animate the changes between the current list and the new one. It synchronizes all new and existent items with notifyItemXXX() calls. An AsyncTask and LinkedHashSet are used to optimize the scan on Big List without blocking the main thread managing the user interface.
Notifications, expandables expanded and headers to be shown, are elaborated in the main thread after AsyncTask is completed the background process.

updateDataSet(new_items*, true);

Note: In both modality, OnUpdateListener is also called as last operation.

* = Nullable

Clone this wiki locally