Android: How to highlight EditText programmatically?
android
Solution
Try this:
_field.setSelection( int startIndex, int endIndex);
The first parameter startIndex is the point in the string where you want to begin highlighting and the endIndex parameter is the point where you want to stop highlighting.
If you want to select all of the text use this instead:
_field.selectAll();
Problem
`requestFocus()` moves the cursor to the edit box, but does not highlight it. I want to highlight it like as if it was touched. How can I do this?