copy link To Clipboard - Android android.content

Android examples for android.content:ClipboardManager

Description

copy link To Clipboard

Demo Code

import android.content.Context;
import java.util.List;

public class Main{

    public static void copyToClipboard(Context context, String link) {

        android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        android.content.ClipData clip = android.content.ClipData
                .newPlainText("url", link);
        clipboard.setPrimaryClip(clip);/*from   ww  w . ja  va2s.c  o  m*/

    }

}

Related Tutorials