Source:
public boolean onContextItemSelected(MenuItem item) { Message message = (Message) adapter.getItem(adapter.getContextMenuItemSelectedPosition()); 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)))); ((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)); ((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())); ((NarrowListener) getActivity()).onNarrowFillSendBox(message, false); } return true; case R.id.copy_message: copyMessage(message); Toast.makeText(getContext(), R.string.message_copied, Toast.LENGTH_SHORT).show(); return true; case R.id.star_message: starMessage(message); Toast.makeText(getContext(), R.string.message_starred, Toast.LENGTH_SHORT).show(); return true; case R.id.un_star_message: unStarMessage(message); Toast.makeText(getContext(), R.string.message_un_starred, Toast.LENGTH_SHORT).show(); return true; default: return super.onContextItemSelected(item); } }

Target:
public boolean onContextItemSelected(MenuItem item) { Message message = (Message) adapter.getItem(adapter.getContextMenuItemSelectedPosition()); 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()); case R.id.star_message: starMessage(message, adapter.getContextMenuItemSelectedPosition()); return true; case R.id.un_star_message: unStarMessage(message, adapter.getContextMenuItemSelectedPosition()); return true; default: return super.onContextItemSelected(item); } }