我想创建一个意图选择只显示一个选项(复制到剪贴板),但是当我这样做时,意图会自动启动(复制到剪贴板)并且不显示选择器。这是我的代码:
Intent copyToClipboard = new Intent(activity, ShareToClipboardActivity.class);
copyToClipboard.putExtra(Intent.EXTRA_TEXT, entry.getEntryShareLink());
LabeledIntent labeledCopyToClipboard = new LabeledIntent(copyToClipboard, activity.getPackageName(), "Copy!", 0);
List<LabeledIntent> intentList = new ArrayList<>();
intentList.add(new LabeledIntent(labeledCopyToClipboard, activity.getPackageName(), "Copy to clipboard", R.drawable.ic_content_copy_gray_24dp));
Intent chooserIntent = Intent.createChooser(new LabeledIntent(labeledCopyToClipboard, activity.getPackageName(), "Copy to clipboard", R.drawable.ic_content_copy_gray_24dp), "Share entry");
activity.startActivity(chooserIntent);
有人可以建议吗?