I have a ListView where each item is a TextView.
I want to enable the long press behaviour similar to an EditText that displays the default context menu with items like “Select all”, “Cut all”, “Copy all”, etc.
Is there an easy way to enable this for a TextView?
I think I have a solution.
Just call
registerForContextMenu(yourTextView);and your
TextViewwill be registered for receiving context menu events.Then override
onCreateContextMenuin yourActivity:Hope this helps you and anyone else looking for a way to copy text from a
TextView