private void saveItem() { mItem.setTitle(mTitle.getText().toString()); mItem.setDetails(mDetails.getText().toString()); // date is already set mItem.setAutodelete(mAutoDelete.isChecked()); ItemManager.get(getActivity()).saveItem(mItem); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Long itemId = null; Bundle args = getArguments(); if (args != null && args.containsKey(ARG_ITEM_ID)) { itemId = (Long) args.getSerializable(ARG_ITEM_ID); } if (itemId != null) { ItemManager mgr = ItemManager.get(getActivity()); mItem = mgr.getItem(itemId); } if (mItem == null) { mItem = new Item(); } }
private void deleteItem() { ItemManager.get(getActivity()).deleteItem(mItem); }