Use Android Architecture Components, there is a problem, LiveData observer Obsever will be called multiple times.
I wording is
private void loadData(FragmentActivity activity) {
RfLoader.showLoading(activity);
multiseriateDialogViewModel.doRequest(url, params).observe(activity, new Observer<List<T>>() {
@Override
public void onChanged(List<T> t) {
if(t != null && !t.isEmpty()) {
beans.clear();
beans.addAll(t);
recyclerViewAdapter.notifyDataSetChanged();
}
}
});
}
That is, each tune once loadData, observe method will adjust once the LiveData.
Check observe the method of source discovery, LiveData can register multiple Observer.
Called multiple times observe method registers many times, my writing is equivalent to repeat the same observer registered several times, of course, it will be called back several times, resulting in duplication of data