/** * Response to add crime action button. * * <p>Toggling the action item subtitle. * * @param item * @return */ @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_item_new_crime: Crime crime = new Crime(); CrimeLab.getInstance(getActivity()).addCrime(crime); Intent intent = CrimePagerActivity.newIntent(getActivity(), crime.getId()); startActivity(intent); return true; case R.id.menu_item_show_subtitle: mSubtitleVisible = !mSubtitleVisible; getActivity().invalidateOptionsMenu(); updateSubtitle(); return true; default: return super.onOptionsItemSelected(item); } }
@Override public void onClick(View v) { Intent intent = CrimePagerActivity.newIntent(getActivity(), mCrime.getId()); startActivity(intent); }