@Override public void onDialogPositiveClick(Item newItem, Item oldItem) { if (oldItem != null) { itemAdapter.remove(oldItem); } itemAdapter.add(newItem); }
@Override public boolean onContextItemSelected(MenuItem item) { int itemPosition = ((AdapterContextMenuInfo) item.getMenuInfo()).position; Item selectedItem = itemAdapter.getItem(itemPosition); switch (item.getItemId()) { case R.id.menu_edit: return editItem(selectedItem); case R.id.menu_delete: itemAdapter.remove(selectedItem); return true; default: return super.onContextItemSelected(item); } }
// TODO maybe I should create button in ActionBar and connect it with this method? public void showMapClick(View w) { Intent showMapIntent = new Intent(SecondTaskAndroid.this, CompassActivity.class); showMapIntent.putParcelableArrayListExtra(STRING_CHECKED_ITEMS, itemAdapter.getCheckedItems()); startActivity(showMapIntent); }
/* Deserializing items */ @Override protected void onPause() { itemAdapter.revertData(); preferencesManager.serializeQuotes(itemAdapter.getItems()); super.onPause(); }