Android - TextView 複製

Android - TextView 複製

private View.OnClickListener mCopyClick = new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        TextView textView = (TextView)view;
        ClipboardManager cm = (ClipboardManager)mContext.getSystemService(Context.CLIPBOARD_SERVICE);
        cm.setText(textView.getText());
        Toast.makeText(mContext, "Copied to clipboard", Toast.LENGTH_SHORT).show();
    }
};