There is a class Model1, which contains some parameters and List.
List<Model1> Class Model1: private String param1; private String param2; private List<Model2> param3List= new ArrayList<>(); I load server data, set it into a fragment
public void setServices(List<Model1> model1) { this.modelList1.clear(); this.modelList1.addAll(model1); } Next, I check this data and add param3List to the adapter.
list.clear(); for (Model2 m2 : modelList1) { list.addAll(m2.getParam3List()); adapter.notifyDataSetChanged(); break; } And for some unknown reason, once list.clear () clears only the sheet that is in the adapter, and another time clears the sheet that is in the adapter and with it param3List, which is in modelList1.
Listfor example. Considering that in thesetmethod you do not make a normalset, but actually add an element to the same list, clearing it ... Are there any reasons why this is exactly how it is implemented? - iksuythis.modelList1 = model1? - iksuy