Example usage for android.content ClipData newPlainText

List of usage examples for android.content ClipData newPlainText

Introduction

In this page you can find the example usage for android.content ClipData newPlainText.

Prototype

static public ClipData newPlainText(CharSequence label, CharSequence text) 

Source Link

Document

Create a new ClipData holding data of the type ClipDescription#MIMETYPE_TEXT_PLAIN .

Usage

From source file:Main.java

public static void copyToClipBoard(Context context, String copyText) {
    ClipData clipData = ClipData.newPlainText("codegank_copy", copyText);
    ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    manager.setPrimaryClip(clipData);/*w  ww . j a  v  a  2s  . c o  m*/
}

From source file:Main.java

public static void copyToClipBoard(Context context, String text, String success) {
    ClipData clipData = ClipData.newPlainText("keep_nice", text);
    ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    manager.setPrimaryClip(clipData);//from  ww  w.j a v a 2 s  .co  m
    Toast.makeText(context, success, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void copyToClipBoard(Context context, String text, String success) {
    ClipData clipData = ClipData.newPlainText("gank", text);
    ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    manager.setPrimaryClip(clipData);/*from  w  w  w  .ja  v a 2 s .c  om*/
    Toast.makeText(context, success, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void cleanUpClipboard(Context context) {
    ClipboardManager cbm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData data = ClipData.newPlainText("", "");
    cbm.setPrimaryClip(data);/*w  w w .  j  av  a 2 s .  c  om*/
}

From source file:Main.java

public static void copy2clipboard(Context context, String text) {
    ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData clip = ClipData.newPlainText("clip", text);
    cm.setPrimaryClip(clip);/*  ww  w  .  ja  v a 2s .c  o  m*/
}

From source file:Main.java

public static void copyText(Context context, String text) {
    ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData clipData = ClipData.newPlainText("GankLy_copy", text);
    manager.setPrimaryClip(clipData);//from   ww w  .  j a  v  a2  s  .c om
}

From source file:Main.java

public static void copyToClipboard(Context context, String text) {
    ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData clip = ClipData.newPlainText("copy", text);
    clipboard.setPrimaryClip(clip);/*from   www  . java2 s .c om*/
}

From source file:Main.java

public static void putTextIntoClipboard(Context context, String text) {
    ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData clipData = ClipData.newPlainText("copy text", text);
    clipboardManager.setPrimaryClip(clipData);
}

From source file:Main.java

public static void setClip(Context context, CharSequence text) {
    ((ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE))
            .setPrimaryClip(ClipData.newPlainText("", text));
}

From source file:Main.java

public static void copy(Context context, String content) {
    ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    cmb.setPrimaryClip(ClipData.newPlainText(null, content));
}