Android Utililty Methods Clipboard Paste

List of utility methods to do Clipboard Paste

Description

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

Method

Stringpaste(Context context)
paste
ClipboardManager cmb = (ClipboardManager) context
        .getSystemService(Context.CLIPBOARD_SERVICE);
return cmb.getText().toString().trim();
voidcopyStringToClipboard(Context context, String string, int toastText)
copy String To Clipboard
ClipboardManager clipboardManager = (ClipboardManager) context
        .getSystemService(Context.CLIPBOARD_SERVICE);
clipboardManager.setPrimaryClip(ClipData.newPlainText("", string));
Toast.makeText(context, toastText, Toast.LENGTH_SHORT).show();
StringgetClipboard(Context context)
get Clipboard
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context
        .getSystemService(Context.CLIPBOARD_SERVICE);
return clipboard.getText().toString();
Stringpaste(Context context)
paste
ClipboardManager cmb = (ClipboardManager) context
        .getSystemService(Context.CLIPBOARD_SERVICE);
return cmb.getText().toString().trim();
StringpasteText(Context context)
paste Text
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context
        .getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard.hasText()) {
    return clipboard.getText().toString();
return "";