0

I have overridden the

OnLongClickListener

of the Android:EditText in order to show my own menu. However I would still like the user to be able to "select text" and "select all" from a button within my custom menu, how should I go about doing that?

EDIT: Sorry I should have put more detail in my question.

I have tried the selectAll() method for selecting the text however this doesn't come up with the two pointers (where the user can drag to select areas) which is what I mean by select text.

kiwijus
  • 1,217
  • 1
  • 20
  • 40

2 Answers2

3

Use findViewBy id to find that EditText when your custom button is pressed then use the following function:

((EditText)v).selectAll();
brian d foy
  • 129,424
  • 31
  • 207
  • 592
Jane
  • 39
  • 4
1

In the Related column I found Select all text inside EditText when it gets focus which is easily adaptable to a context menu, you might find "select word" tactics there too.

Community
  • 1
  • 1
Sam
  • 86,580
  • 20
  • 181
  • 179