Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7195

edittext setSelection is crashing the app when accessibility talkback is turned on

$
0
0

I have an edittext for date and it automatically adds a slash for the date. To do so, I have a text change listener with this code in it.

if (currentTextLength == 2 || currentTextLength == 5) {
   editText.setText("$s/")
   editText.setSelection(editText.text.length)
}

setSelection places the cursor at the end of the text but it is taking the value as Spannable(if you look at its implementation) which will crash when Accessibility talkback is turned on. Is there a way to place the cursor at the end of the edittext without using setSelection? I tried append but it is not placing the cursor at the end.

The crash exception is IndexOutOfBoundException caused by Spannable when accessibility talkback is on.

Thanks in advanced.


Viewing all articles
Browse latest Browse all 7195

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>