Source:
<code>public void onBindViewHolder(final ViewHolder holder, final int position) { final RecentItem currentItem = items.get(position); holder.setItem(currentItem); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getSelectedItemCount() == 0) { Intent myIntent = new Intent(); myIntent.setClass(context, StudyActivity.class); String dbPath = currentItem.dbPath; myIntent.putExtra(StudyActivity.EXTRA_DBPATH, dbPath); recentListUtil.addToRecentList(dbPath); context.startActivity(myIntent); } else { toggleSelection(position); } updateActionMode(); } }); holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { <START> AppCompatActivity appCompatActivity = (AppCompatActivity) context; <END> if (getSelectedItemCount() == 0) { actionMode = appCompatActivity.startSupportActionMode(actionModeCallback); } toggleSelection(position); updateActionMode(); return true; } }); holder.moreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String dbPath = currentItem.dbPath; DialogFragment df = new OpenActionsFragment(); Bundle b = new Bundle(); b.putString(OpenActionsFragment.EXTRA_DBPATH, dbPath); df.setArguments(b); df.show(((FragmentActivity) context).getSupportFragmentManager(), "OpenActions"); } }); holder.selectedOverlay.setVisibility(isSelected(position) ? View.VISIBLE : View.INVISIBLE); }</code><technical_language>concern is right. Converting context activity is right approach. 3 ways deal this problem: 1. In holder's constructor, need set a callback Predicate<Void> startSupportActionModeProxy create Adapter, need pass in startSupportActionModeProxy Activity passing holder. create startSupportActionModeProxy in Activity startSupportActionMode(actionModeCallback) 2. A simpler verbose is LocalBroadcastManager, want startSupportActionMode, basically send a broadcast intent. In Activity, register broadcastReceiver in onStart unregister in onStop listen intent action defined. receive intent startSupportActionMode, call startSupportActionMode(actionModeCallback) 3. If want EventBus, need add dependency: <LINK_0>, this is simplest, requires add a library. is similar approach 2</technical_language>

Target:
public void onBindViewHolder(final ViewHolder holder, final int position) { final RecentItem currentItem = items.get(position); holder.setItem(currentItem); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getSelectedItemCount() == 0) { Intent myIntent = new Intent(); myIntent.setClass(context, StudyActivity.class); String dbPath = currentItem.dbPath; myIntent.putExtra(StudyActivity.EXTRA_DBPATH, dbPath); recentListUtil.addToRecentList(dbPath); context.startActivity(myIntent); } else { toggleSelection(position); } recentListActionModeUtil.updateActionMode(getSelectedItemCount()); } }); holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (getSelectedItemCount() == 0) { recentListActionModeUtil.startActionMode(); } toggleSelection(position); recentListActionModeUtil.updateActionMode(getItemCount()); return true; } }); holder.moreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String dbPath = currentItem.dbPath; DialogFragment df = new OpenActionsFragment(); Bundle b = new Bundle(); b.putString(OpenActionsFragment.EXTRA_DBPATH, dbPath); df.setArguments(b); df.show(((FragmentActivity) context).getSupportFragmentManager(), "OpenActions"); } }); holder.selectedOverlay.setVisibility(isSelected(position) ? View.VISIBLE : View.INVISIBLE); }