I have an custom Edittext
that is extended from AppCompatEditText
and It shows date text like "10.02.2012 10:40"
When user clicks one time over any part of texts, the part should be selected automatically.
For example:
To do it, in my custom edittext, I overrode onSelectonChange
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
if (isFocused() && isCursorVisible() && isPressed()) {
int[] aFoo = findPartOfText(selStart, selEnd);
selStart = aFoo [0];
selEnd = aFoo [1];
}
super.onSelectionChanged(selStart, selEnd);
}
It doesn't change anything. I have also tried this :
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
//Select first 3 characters
super.onSelectionChanged(0, 2);
}
Result is same. It doesn't select the first 3 characters as well.