Android 选择器中缺少剪贴板
Android Clipboard missing in Chooser
当我想在我的应用程序中共享基本纯文本时,将其复制到剪贴板的选项没有显示在选择器列表中。我的代码有问题吗?还是我的设备设置有误?
String code = getXMLCode();
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, code);
startActivity(Intent.createChooser(sharingIntent, getString(R.string.shareXMLCode)));
public String getXMLCode(){...}
Android 没有 "copy to clipboard" 选项作为 ACTION_SEND
的一部分。某些应用程序,例如 Google 云端硬盘,可能会提供此类功能。
cketti 最近写了 a blog post 关于如何将自己的 "copy to clipboard" 选项添加到自己的 ACTION_SEND
请求。简而言之,您使用 EXTRA_INITIAL_INTENTS
向选择器添加另一个选项,一个指向您自己的 activity 的选项将提供 "copy to clipboard".
当我想在我的应用程序中共享基本纯文本时,将其复制到剪贴板的选项没有显示在选择器列表中。我的代码有问题吗?还是我的设备设置有误?
String code = getXMLCode();
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, code);
startActivity(Intent.createChooser(sharingIntent, getString(R.string.shareXMLCode)));
public String getXMLCode(){...}
Android 没有 "copy to clipboard" 选项作为 ACTION_SEND
的一部分。某些应用程序,例如 Google 云端硬盘,可能会提供此类功能。
cketti 最近写了 a blog post 关于如何将自己的 "copy to clipboard" 选项添加到自己的 ACTION_SEND
请求。简而言之,您使用 EXTRA_INITIAL_INTENTS
向选择器添加另一个选项,一个指向您自己的 activity 的选项将提供 "copy to clipboard".