@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); UUID crimeId = (UUID) getArguments().getSerializable(ARG_CRIME_ID); mCrime = CrimeLab.get(getActivity()).getCrime(crimeId); setHasOptionsMenu(true); }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_item_delete_crime: CrimeLab.get(getActivity()).deleteCrime(mCrime); Intent intent = new Intent(getActivity(), CrimeListActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); getActivity().finish(); return true; default: return super.onOptionsItemSelected(item); } }
@Override public void onPause() { super.onPause(); CrimeLab.get(getActivity()).updateCrime(mCrime); }