Android Looper 复制粘贴

Cocos Js代码 调用 Android
// 复制到剪贴板
public static void pasteString(String id){
Log.e("含丰富的撒",id);

    new Thread() {
        @Override
        public void run() {
            Looper.prepare();
            Toast.makeText(AppActivity.getContext(),"复制成功",Toast.LENGTH_LONG).show();
            Looper.loop();
        }
    }.start();

    Thread.interrupted(); // 结束Thread
    Looper.prepare(); // //给线程创建一个消息循环
    Log.e("放得开积分卡复活","");
    ClipboardManager cm = (ClipboardManager)context.getSystemService(Context.CLIPBOARD_SERVICE);
    cm.setText(id);

    // static 里面加AppActivity.getContext() *********

// Toast.makeText(AppActivity.getContext(),"复制成功",Toast.LENGTH_LONG).show();

}

你可能感兴趣的:(Android Looper 复制粘贴)