public void setListAdapter() { // Initialize dao to retrieve Items from DB m_dao = new ItemDao(this.getActivity()); this.m_adapter = new EditItemListAdapter(this.getActivity(), R.layout.row, m_dao.getList()); setListAdapter(this.m_adapter); this.m_adapter.setOnEditItemClickListener( new EditItemListAdapter.OnEditItemClickListener() { /** Update the item status in the DB table */ @Override public void OnSelectItem(Item item) { if (!toDelete.contains(item)) toDelete.add(item); } @Override public void OnDeselectItem(Item item) { if (toDelete.contains(item)) toDelete.remove(item); } }); }
void refreshList() { this.m_adapter.items.clear(); this.m_adapter.items.addAll(m_dao.getList()); this.m_adapter.notifyDataSetChanged(); }