Source:
public void onItemLongClick(final ProjectData item, CheckableVH holder) { CharSequence[] items = new CharSequence[]{ getString(R.string.copy), getString(R.string.delete), getString(R.string.rename), getString(R.string.show_details), getString(R.string.upload_button), getString(R.string.save_to_external_storage_button) }; new AlertDialog.Builder(getActivity()) .setTitle(item.projectName) .setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: copyItems(new ArrayList<>(Collections.singletonList(item))); break; case 1: showDeleteAlert(new ArrayList<>(Collections.singletonList(item))); break; case 2: showRenameDialog(new ArrayList<>(Collections.singletonList(item))); break; case 3: ProjectDetailsFragment fragment = new ProjectDetailsFragment(); Bundle args = new Bundle(); args.putSerializable(ProjectDetailsFragment.SELECTED_PROJECT_KEY, item); fragment.setArguments(args); getFragmentManager().beginTransaction() .replace(R.id.fragment_container, fragment, ProjectDetailsFragment.TAG) .addToBackStack(ProjectDetailsFragment.TAG) .commit(); break; case 4: Intent intent = new Intent(getActivity(), ProjectUploadActivity.class) .putExtra(ProjectUploadActivity.PROJECT_NAME, item.getName()); startActivity(intent); break; case 5: new RequiresPermissionTask(PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE, Arrays.asList(WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE), R.string.runtime_permission_general) { @Override public void task() { StatusBarNotificationManager notificationManager = StatusBarNotificationManager.getInstance(); int notificationID = notificationManager.createSaveProjectToExternalMemoryNotification(getContext(), item.projectName); new CopyProjectToExternalStorageAsyncTask().execute(new Pair<>(item.projectName, notificationID)); } }.execute(getActivity()); break; default: dialog.dismiss(); } } }) .show(); }

Target:
public void onItemLongClick(final ProjectData item, CheckableVH holder) { CharSequence[] items = new CharSequence[]{ getString(R.string.copy), getString(R.string.delete), getString(R.string.rename), getString(R.string.show_details), getString(R.string.upload_button), getString(R.string.save_to_external_storage_button) }; new AlertDialog.Builder(getActivity()) .setTitle(item.projectName) .setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: copyItems(new ArrayList<>(Collections.singletonList(item))); break; case 1: showDeleteAlert(new ArrayList<>(Collections.singletonList(item))); break; case 2: showRenameDialog(new ArrayList<>(Collections.singletonList(item))); break; case 3: ProjectDetailsFragment fragment = new ProjectDetailsFragment(); Bundle args = new Bundle(); args.putSerializable(ProjectDetailsFragment.SELECTED_PROJECT_KEY, item); fragment.setArguments(args); getFragmentManager().beginTransaction() .replace(R.id.fragment_container, fragment, ProjectDetailsFragment.TAG) .addToBackStack(ProjectDetailsFragment.TAG) .commit(); break; case 4: Intent intent = new Intent(getActivity(), ProjectUploadActivity.class) .putExtra(ProjectUploadActivity.PROJECT_NAME, item.getName()); startActivity(intent); break; case 5: new RequiresPermissionTask(PERMISSIONS_REQUEST_EXPORT_TO_EXTERNAL_STORAGE, Arrays.asList(WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE), R.string.runtime_permission_general) { @Override public void task() { StatusBarNotificationManager notificationManager = StatusBarNotificationManager.getInstance(); int notificationID = notificationManager.createSaveProjectToExternalMemoryNotification(getContext(), item.projectName); new ExportProjectToExternalStorageAsyncTask().execute(new Pair<>(item.projectName, notificationID)); } }.execute(getActivity()); break; default: dialog.dismiss(); } } }) .show(); }