Android examples for android.content:Clipboard
copy From Edit via Clipboard
import android.content.ClipData; import android.content.Context; import android.os.Build; public class Main{ /**/* w ww .ja v a 2 s . c o m*/ * * @param context * @param label User-visible label for the clip data. * @param text The actual text in the clip. */ public static void copyFromEdit(Context context, CharSequence label, CharSequence text) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ((android.content.ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE)) .setPrimaryClip(ClipData.newPlainText(label, text)); return; } ((android.text.ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE)).setText(text); } }