Android ClipboardManager set text

Description

Android ClipboardManager set text

import android.app.Activity;
import android.content.Context;
import android.text.ClipboardManager;

public class Main{

    public static void copyText(Activity ctx, String text) {
        ClipboardManager cbm = (ClipboardManager) ctx.getSystemService(Context.CLIPBOARD_SERVICE);
        cbm.setText(text);/*  w  w  w .  j a  v a  2s .  c om*/
   
    }
}



PreviousNext

Related