@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_switch_view_mode: mWeekMode = !mWeekMode; if (mWeekMode) { menuItemSwitchView.setIcon(R.drawable.ic_action_day_view); } else { menuItemSwitchView.setIcon(R.drawable.ic_action_week_view); } attachSectionPagerAdapter(); return true; case R.id.action_export_calendar: detachSectionPagerAdapter(); exportCalendarToGoogle(); // Enable automatic calendar synchronisation Utils.setInternalSetting(this, Const.SYNC_CALENDAR, true); supportInvalidateOptionsMenu(); return true; case R.id.action_delete_calendar: deleteCalendarFromGoogle(); return true; default: detachSectionPagerAdapter(); isFetched = false; return super.onOptionsItemSelected(item); } }