Code example for MenuItem

Methods: getItemId, getMenuInfo

0
        } 
    } 
 
    @Override 
    public boolean onContextItemSelected(MenuItem item) {
        AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
 
        switch (item.getItemId()) {
            case CONTEXT_FLAG_WATCHED_ID: {
                onFlagEpisodeWatched(info, true);
                return true; 
            } 
            case CONTEXT_FLAG_UNWATCHED_ID: {
                onFlagEpisodeWatched(info, false);
                return true; 
            } 
            case CONTEXT_CHECKIN_ID: {
                onCheckinEpisode((int) info.id);
                return true; 
            } 
        } 
        return super.onContextItemSelected(item);
    } 
 
    private void onCheckinEpisode(int episodeTvdbId) {
        CheckInDialogFragment f = CheckInDialogFragment.newInstance(getActivity(), episodeTvdbId);
        f.show(getFragmentManager(), "checkin-dialog");