Skip to content

Instantly share code, notes, and snippets.

@corlaez
Created October 9, 2016 20:02
Show Gist options
  • Save corlaez/aadd795922958f807a6eefbd1a504243 to your computer and use it in GitHub Desktop.
Save corlaez/aadd795922958f807a6eefbd1a504243 to your computer and use it in GitHub Desktop.
Copy to clipboard
public void copyToClipboard() {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(label, text);
clipboard.setPrimaryClip(clip);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment