I have to implement textedit where last three chars are bold. I have 3 specific situactions:
- when user scan barcode
- when user insert value with keyboard
- when device insert value from db
so I implement it with html that I put into textedit, to implement this 3 situations I using function doOnTextChanged, but the device is specific scanner and when I use any method from TextWatcher the one important functionality from scanner device stop working.
The functionality is after scan barcode system android return Keycode_ENTER (onKeyListener).
I need to find something like TextWatcher to get dynamically what user types in textedit.
I tried: 1)Don't setText from WatchText object. 2)WatchText update livedata variable and execute settext in observer 3) I cant manually execute keycode_Enter! I have to know if value is scanned
You could be to use the
addTextChangedListenermethod instead of theTextWatcherinterface to listen for changes in the text editor.Here's an example code snippet to get you started:
Then, to use this custom
TextWatcherclass in your text editor, you can register it with theaddTextChangedListenermethod like this: