focusableInTouchMode behaviour in android

14 Views Asked by At

I accidentally find the difference in behavior of a button with and without set its xml attribute focusableInTouchMode.
As you can see in the picture below, I have an edittext and a button used to bold the selected text, when I explicitly set focusableInTouchMode:true for my button in xml file, then I select a specific text of the edittext after that I click the button, it showed me an error like this

2024-03-01 11:10:54.663 20564-20564 IInputConnectionWrapper com.example.wordfrequency W getTextBeforeCursor on inactive InputConnection
2024-03-01 11:10:54.694 20564-20564 IInputConnectionWrapper com.example.wordfrequency W getTextAfterCursor on inactive InputConnection
2024-03-01 11:10:54.702 20564-20564 IInputConnectionWrapper com.example.wordfrequency W getSelectedText on inactive InputConnection
2024-03-01 11:10:54.706 20564-20564 IInputConnectionWrapper com.example.wordfrequency W getTextBeforeCursor on inactive InputConnection
2024-03-01 11:10:54.710 20564-20564 IInputConnectionWrapper com.example.wordfrequency W getTextBeforeCursor on inactive InputConnection

and I realize that it didn't perform a click on my button. But when I don't declare that attribute explicitly in xml file, I do above process again, it didn't show any error and preform a click for me.
Could anybody explain for me this situation deeply please. I do appreciate all of your contributions. Thank you very much.
enter image description here

0

There are 0 best solutions below