I want to enable standard copy paste for a TextView (the same as for EditText). How can I do it?
I tried using a non-editable EditText but it didn\'t work well (some
Requires API 11, Updated Code, previous method is deprecated
Solution for theme full screen without ActionBar
Extend TextView and in constructor paste following code
this.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
ClipboardManager cManager = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData cData = ClipData.newPlainText("text", getText());
cManager.setPrimaryClip(cData);
Util.toast(mContext, string.text_copyed);
return true;
}
});