0
I need to recover a user-selected string in a Textview, but the method getSelectionStart returns the same value as getSelectionEnd.
Here is an example in the image below:
I performed the test on a Samsung Galaxy S7 Edge and an Asus and both showed the same behavior.
Does anyone know any other way to retrieve a selected string in a Textview?
EDIT:
Sample code:
TextView textView = (TextView) findViewById(R.id.text_view);
int selectionStart = textView.getSelectionStart(); // Retorna 10 (era pra retornar 4)
int selectionEnd = textView.getSelectionEnd(); // Retorna 10 (correto)
Thank you.
has some code?
– viana
@seamusd, added.
– André Amaral Braga