copy To Clipboard via ClipboardManager - Android android.content

Android examples for android.content:Clipboard

Description

copy To Clipboard via ClipboardManager

Demo Code

import android.annotation.TargetApi;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.Build;

public class Main{

    public static void copyToClipboardSupport(Context context, String text) {
        android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        clipboard.setText(text);//from   w  w  w .ja v  a  2 s .c o  m
    }

}

Related Tutorials