Hello!
When working with RecyclerView, you need to update its visual component. But you have to sculpt crutches. Why?
//Не работает // tempMedicineList = db.readAll(); // recyclerView.getAdapter().notifyDataSetChanged(); //Костыль, который работает if (recyclerView.getAdapter() != null) { recyclerView.setAdapter(null); } MedicineAdapter medicineAdapter = new MedicineAdapter(this, db.readAll()); medicineAdapter.setOnClickListener(this); recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); recyclerView.setAdapter(medicineAdapter);
tempMedicineList.clear(); tempMedicineList.addAll(db.readAll()); recyclerView.getAdapter().notifyDataSetChanged();tempMedicineList.clear(); tempMedicineList.addAll(db.readAll()); recyclerView.getAdapter().notifyDataSetChanged();- Yura Ivanov