Breaking News
Home / Android / Android Snippets / How to copy text into Clipboard in Android?

How to copy text into Clipboard in Android?

Snippet

  // get the char sequence

  CharSequence displayContents = resultHandler.getDisplayContents();
  ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);

// set the contents
  clipboard.setText(displayContents)

[pb_builder]

Check Also

How to check if an Android device can connect to Internet?

The following code snippet shows how to check if an Android device can connect to …

Advertisment ad adsense adlogger