sketchub icon

Copy/Paste in Android Using TextView

CoCoCo_CoCoCo
7 Likes
0 Comments
32 Downloads

Screenshots

About

  • How To Implement Copy/Paste in Android Using TextView:

1). Add to Edittext1 and Textview1

2). Remplace Edittext1 to tv

3). Click "onCreate" and then search for "add source directly".

4). Copy the code and then paste the code into an empty "add source directly".

registerForContextMenu(tv);

5). Search for "onCreateContextMenu" and then search for "Add Source directly".

6). Copy the code and then paste the code into an empty "add source directly".

menu.add(0, view.getId(),0, "Copy");
menu.setHeaderTitle("Copy text");
((ClipboardManager) getSystemService(getApplicationContext().CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("clipboard", tv.getText().toString()));

END.

©2025 Sketchub | User Policy