剪切板(复制、粘贴)工具类

package kale.http.framework.util;

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

/**
 * @author http://blog.csdn.net/voiceofnet/article/details/7741259
 * @date 2015/8/6
 */
public class ClipBoardUtil {

    public static void copy(Context context,String text) {
        ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
        cmb.setText(text.trim());
    }

    /**
     * 实现粘贴功能
     * add by wangqianzhou
     */
    public static String paste(Context context) {
        ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
        return cmb.getText().toString().trim();
    }
}

 

posted @ 2015-08-08 14:33  developer_Kale  阅读(417)  评论(0编辑  收藏
网站流量统计工具