Source:
<code>public boolean onContextItemSelected(MenuItem item) { int position = adapter.getContextMenuItemSelectedPosition(); if (position == RecyclerView.NO_POSITION) { <START> return false; <END> } Message message = (Message) adapter.getItem(position); switch (item.getItemId()) { case R.id.reply_to_stream: ((NarrowListener) getActivity()).onNarrowFillSendBox(message, true); return true; case R.id.reply_to_private: ((NarrowListener) getActivity()).onNarrowFillSendBox(message, true); return true; case R.id.reply_to_sender: Person[] senderList = {message.getSender()}; ((NarrowListener) getActivity()).onNarrowFillSendBoxPrivate(senderList, true); return true; case R.id.narrow_to_private: if (getActivity() instanceof NarrowListener) { ((NarrowListener) getActivity()).onNarrow(new NarrowFilterPM(Arrays.asList(message.getRecipients(app))), message.getId()); ((NarrowListener) getActivity()).onNarrowFillSendBox(message, false); } return true; case R.id.narrow_to_stream: if (getActivity() instanceof NarrowListener) { ((NarrowListener) getActivity()).onNarrow(new NarrowFilterStream(message.getStream(), null), message.getId()); ((NarrowListener) getActivity()).onNarrowFillSendBox(message, false); } return true; case R.id.narrow_to_subject: if (getActivity() instanceof NarrowListener) { ((NarrowListener) getActivity()).onNarrow(new NarrowFilterStream(message.getStream(), message.getSubject()), message.getId()); ((NarrowListener) getActivity()).onNarrowFillSendBox(message, false); } return true; case R.id.copy_message: copyMessage(message); return true; case R.id.edit_message: editMessage(message, adapter.getContextMenuItemSelectedPosition()); return true; default: return super.onContextItemSelected(item); } }</code><technical_language>if show user some message toast well</technical_language>

Target:
public boolean onContextItemSelected(MenuItem item) { int position = adapter.getContextMenuItemSelectedPosition(); if (position == RecyclerView.NO_POSITION) { Toast.makeText(getContext(), R.string.try_again_error_msg, Toast.LENGTH_SHORT).show(); return false; } Message message = (Message) adapter.getItem(position); switch (item.getItemId()) { case R.id.reply_to_stream: ((NarrowListener) getActivity()).onNarrowFillSendBox(message, true); return true; case R.id.reply_to_private: ((NarrowListener) getActivity()).onNarrowFillSendBox(message, true); return true; case R.id.reply_to_sender: Person[] senderList = {message.getSender()}; ((NarrowListener) getActivity()).onNarrowFillSendBoxPrivate(senderList, true); return true; case R.id.narrow_to_private: if (getActivity() instanceof NarrowListener) { ((NarrowListener) getActivity()).onNarrow(new NarrowFilterPM(Arrays.asList(message.getRecipients(app))), message.getId()); ((NarrowListener) getActivity()).onNarrowFillSendBox(message, false); } return true; case R.id.narrow_to_stream: if (getActivity() instanceof NarrowListener) { ((NarrowListener) getActivity()).onNarrow(new NarrowFilterStream(message.getStream(), null), message.getId()); ((NarrowListener) getActivity()).onNarrowFillSendBox(message, false); } return true; case R.id.narrow_to_subject: if (getActivity() instanceof NarrowListener) { ((NarrowListener) getActivity()).onNarrow(new NarrowFilterStream(message.getStream(), message.getSubject()), message.getId()); ((NarrowListener) getActivity()).onNarrowFillSendBox(message, false); } return true; case R.id.copy_message: copyMessage(message); return true; case R.id.edit_message: editMessage(message, adapter.getContextMenuItemSelectedPosition()); return true; default: return super.onContextItemSelected(item); } }