@Nullable @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_active_reminders, container, false); adapter = new ReminderAdapter(ReminderHelper.getActiveReminders(), getContext()); adapter.setHasStableIds(true); recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setHasFixedSize(true); recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getContext())); return view; }
public void notifyDataSetChanged() { if (adapter != null) { adapter.setReminders(ReminderHelper.getActiveReminders()); adapter.notifyDataSetChanged(); } }