XxGoliathusxX
XxGoliathusxX

Reputation: 982

Android Clipboard missing in Chooser

When I want to share basic plaintext in my app, the option to copy it in my clipboard does not show up in the chooserlist. Is there something wrong with my code? Or has my device a wrong setup?

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(){...}

Upvotes: 1

Views: 457

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007296

Android does not have a "copy to clipboard" option as part of ACTION_SEND. Certain apps, like Google Drive, might offer such a feature.

cketti recently wrote a blog post about how you can add your own "copy to clipboard" option to your own ACTION_SEND requests. In a nutshell, you use EXTRA_INITIAL_INTENTS to add another option to the chooser, one that points to your own activity that will offer "copy to clipboard".

Upvotes: 2

Related Questions