android.text.ClipboardManager was deprecated since API level 11, and replaced with android.content.ClipboardManager (source).
android.text.ClipboardManager
android.content.ClipboardManager
How do I write c
If you are still supporting < SDK 11 you are doing too much work. Set min to 15 and use this code:
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("label for text", "text to copy"); clipboard.setPrimaryClip(clip);