Get Clipboard service, clipboard Copy Text - Android Android OS

Android examples for Android OS:Clipboard

Description

Get Clipboard service, clipboard Copy Text

Demo Code


//package com.java2s;
import android.content.Context;
import android.text.ClipboardManager;

public class Main {
    public static final void clipboardCopyText(Context context,
            CharSequence text) {// w w  w  .ja  v  a  2  s  .  c om
        ClipboardManager cm = (ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        if (cm != null) {
            cm.setText(text);
        }
    }
}

Related Tutorials