The getSelectionStart (TextView) method returns incorrect value

0

I need to retrieve a user-selected string in a TextView, but the method getSelectionStart returns the same value as getSelectionEnd.

Here's an example in the image below:

I performed the test on a Samsung Galaxy S7 Edge and an Asus, and both performed the same behavior.

Does anyone know of 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.

    
asked by anonymous 06.10.2016 / 19:55

0 answers