This code works fine when i add some data into \'List model\' and restore saved data on rotation device, unfortunately after restore data and set that to model
The main reason is that, because you called set-data and that method did not immediately notify that the data set was changed, therefore it was not ware.
public void setData(List data) {
Log.e("data size ", data.size() + "");
list.clear();
list.addAll(data);
}
public void setData(Listdata) { Log.e("data size ", data.size() + "");
list.clear();
notifyDataSetChanged(); //here,to signal change occurred.
list.addAll(data);
notifyDataSetChanged(); //here,to signal change occurred.
}
should probably get into the habit of notifying changes on the spot.
The main problem is this, you never notified the changes you made, you cleared it , but you never told it, you know, bu the adapter does not know, also you inserted fresh data with addAll but you still did not notify it.