List of usage examples for android.content ClipData newPlainText
static public ClipData newPlainText(CharSequence label, CharSequence text)
From source file:Main.java
public static void copy(Context context, String label, String content) { ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); cmb.setPrimaryClip(ClipData.newPlainText(label, content)); }
From source file:Main.java
public static void copyText(Context context, String text) { ClipboardManager cmbName = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clipDataName = ClipData.newPlainText(null, text); cmbName.setPrimaryClip(clipDataName); }
From source file:Main.java
public static void putString(Context context, String string) { ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); manager.setPrimaryClip(ClipData.newPlainText("text", string)); }
From source file:Main.java
public static void setPlainText(@Nullable Context context, @Nullable CharSequence label, @Nullable CharSequence text) { ClipData clip = ClipData.newPlainText(label, text); getManager(context).setPrimaryClip(clip); }
From source file:Main.java
public static void copyToClipboard(String text) { ClipboardManager cbm = (ClipboardManager) mContex.getSystemService(Activity.CLIPBOARD_SERVICE); cbm.setPrimaryClip(ClipData.newPlainText(mContex.getPackageName(), text)); }
From source file:Main.java
public static void copyToClipboard(final Context context, final String text) { final ClipboardManager cbm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); cbm.setPrimaryClip(ClipData.newPlainText(context.getPackageName(), text)); }
From source file:Main.java
public static void copyToClipBoard(Context context, String key, String value) { ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clipData = ClipData.newPlainText(key, value); clipboardManager.setPrimaryClip(clipData); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void copyToClipboard(Context context, String text) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setPrimaryClip(ClipData.newPlainText(null, text)); }
From source file:Main.java
/***** API>=11 *****/ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void copyToClipboard(Context context, String text) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setPrimaryClip(ClipData.newPlainText(null, text)); }
From source file:Main.java
/** * Copies text.// w w w .j a v a 2s. com * * @param text The actual text we want to copy. */ public static void copyText(Context context, CharSequence text) { ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clipData = ClipData.newPlainText("simple text", text); clipboardManager.setPrimaryClip(clipData); }