Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Copy and Paste with TextView

I have a textview which displays a lot of text.

My users want to highlight and copy a snip of code to the clipboard.

Any pointers on how to do that?

like image 507
Ian Vink Avatar asked Aug 31 '10 00:08

Ian Vink


People also ask

How do I copy text from TextView?

Select + copy text in a TextView? Generally, we can copy / paste the value from EditText by long click. It is an in-build functionality for Android.

How do I enable copy and paste on Android?

Long-tap a word to select it on a web page. Drag the set of bounding handles to highlight all the text you want to copy. Tap Copy on the toolbar that appears.

Why copy paste is not working in Android Studio?

Updating the Android Studio and Invalidate Caches/Restart option doesn't worked for me. But Paste Simple or Ctrl + Alt + Shift + V will works when you are trying to paste something from outside. Try using Copy Reference or Ctrl + Alt + Shift + C and Paste or Ctrl + V . It works for me.

How do you copy to clipboard on Android?

Highlight the text, long-press the selected text, then choose Copy. Long-press an empty field and select Paste to insert the copied text. Alternative method: Use the Gboard keyboard to manage the clipboard.


2 Answers

Modify the textIsSelectable property:

android:textIsSelectable="true" 
like image 99
vrbsm Avatar answered Oct 05 '22 13:10

vrbsm


Have you tried Copy Paste - Android Developers Site?

like image 45
Erez A. Korn Avatar answered Oct 05 '22 12:10

Erez A. Korn