Android Clipboard Copy copyToClipboard(Context context, String lable, String text)

Here you can find the source of copyToClipboard(Context context, String lable, String text)

Description

copy To Clipboard

Declaration

public static boolean copyToClipboard(Context context, String lable,
            String text) 

Method Source Code

//package com.java2s;

import android.content.Context;

public class Main {
    public static boolean copyToClipboard(Context context, String lable,
            String text) {/*w  ww.j av a 2s.c  om*/
        try {
            android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context
                    .getSystemService(Context.CLIPBOARD_SERVICE);
            android.content.ClipData clip = android.content.ClipData
                    .newPlainText(lable, text);
            clipboard.setPrimaryClip(clip);

            return true;
        } catch (Exception e) {
            return false;
        }
    }
}

Related

  1. onCopy(Context context, String content)
  2. copyToClipboard(Context context, String label, String string, int toastMessageId)
  3. copyToClipboard(Context context, String lable, String text)
  4. set(Context context, String value)
  5. setClipboard(Context context, String text)
  6. setText(final Context context, final CharSequence text)