Set text to Clipboard - Android android.content

Android examples for android.content:Clipboard

Description

Set text to Clipboard

Demo Code

import android.content.ClipboardManager;
import android.content.Context;

public class Main{

    public static void copy(Context context, String text) {
        ClipboardManager cmb = (ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        cmb.setText(text.trim());/*from w  w  w.  j  a  va  2  s  . co m*/
    }

}

Related Tutorials