List of usage examples for android.content ClipboardManager setText
@Deprecated public void setText(CharSequence text)
From source file:Main.java
@TargetApi(11) public static void copy(String content, Context context) { ClipboardManager cmb = (ClipboardManager) context.getSystemService("clipboard"); cmb.setText(content.trim()); }
From source file:Main.java
public static void copyToClipboard(Context context, String content) { ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); cmb.setText(content.trim()); }
From source file:Main.java
public static void copyToClipboard(String content, Context context) { ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); cmb.setText(content.trim()); }
From source file:Main.java
public static void cpTextToclipoard(Context c, String text) { ClipboardManager clipboard = (ClipboardManager) c.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(text); }
From source file:Main.java
public static void copy(Context context, String content) { ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); cmb.setText(content); }
From source file:Main.java
public static void copy2Clipboard(Context context, String content) { content = content.trim();/*from w ww .j av a 2 s . c o m*/ ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); cmb.setText(content.trim()); }
From source file:Main.java
public static void copyToClipBoard(Context context, String content) { ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); cm.setText(content); }
From source file:Main.java
public static void copy2Clipboard(Activity activity, String content) { ClipboardManager clipboardManager = (ClipboardManager) activity .getSystemService(Activity.CLIPBOARD_SERVICE); clipboardManager.setText(content); }
From source file:Main.java
public static void clip(Context context, String text) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { android.text.ClipboardManager clipboardManager = (android.text.ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); clipboardManager.setText(text); } else {/*from www . java 2 s .c om*/ ClipboardManager clipboardManager = (ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); clipboardManager.setPrimaryClip(ClipData.newPlainText("mq_content", text)); } }
From source file:Main.java
/** * This will copy text to the device's clipboard. * * @param context an application or activity context * @param text the string to be copied to the clipboard * @param description a user-visible label for the copied text *///from w ww . jav a 2 s. co m @TargetApi(VERSION_CODES.HONEYCOMB) public static void copyText(Context context, String text, String description) { if (IS_AT_LEAST_HC) { ClipData clip = ClipData.newPlainText(description, text); ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setPrimaryClip(clip); } else { android.text.ClipboardManager cm = (android.text.ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); cm.setText(text); } }