Java tutorial
//package com.java2s; //License from project: Apache License import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; public class Main { public static void copy(Context context, String str) { ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); String lable = str; if (str.length() > 10) lable = str.substring(0, 10); clipboardManager.setPrimaryClip(ClipData.newPlainText(lable, str)); } }