copy Text To ClipBoard - Android Android OS

Android examples for Android OS:Clipboard

Description

copy Text To ClipBoard

Demo Code


//package com.java2s;

import android.content.ClipboardManager;

import android.content.Context;

import android.text.TextUtils;

public class Main {
    @SuppressWarnings("deprecation")
    public static void copyTextToBoard(Context context, String string) {
        if (TextUtils.isEmpty(string))
            return;
        ClipboardManager clip = (ClipboardManager) context
                .getSystemService(Context.CLIPBOARD_SERVICE);
        clip.setText(string);/*from  w ww  .  j  a  v  a2  s.c om*/
    }
}

Related Tutorials