Android Utililty Methods Clipboard Copy

List of utility methods to do Clipboard Copy

Description

The list of methods to do Clipboard Copy are organized into topic(s).

Method

voidcopyText(Context context, String text)
copy Text
ClipData cd = ClipData.newPlainText(text, text);
ClipboardManager cm = (ClipboardManager) context
        .getSystemService(Context.CLIPBOARD_SERVICE);
cm.setPrimaryClip(cd);
voidcopyText(Context context, String text)
copy Text
if (TextUtils.isEmpty(text)) {
    return;
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context
        .getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(text);