I want to make something happen on text selection, which is OnLongClickListener, but inside of that I need to get selected text, which is handled by default OnLongClickListener (at least I think it is). Actual result, by adding just my listener, is that my method is called, I'm trying to get indices of selection bounds, but these are 0. I can also see in debugger, that no text is selected in that momment.
Code:
textView.setTextIsSelectable(true);
textView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
int start = textView.getSelectionStart();
int end = textView.getSelectionEnd();
// the rest of code
}
}
}
Question: How can I preserve default listener, which will be called first and make selection and then call my function.