I am building a android app in which there is a screen in which there are two tabs in form of fragment fragments are basically used for language translation. The problem is when i input something inside the the edit text of Multi Fragment and try to select it after i finished selecting if i suddenly move to the single fragment the cursor is still visible on single fragment for some duration ,Also the cursor is visible ANYWHERE in Single fragment screen.I'm not adding the code file because i think its not any logical problem its something related to FOCUSED.But if any one still need the code Please comment in question i will add that .
Image 2 where currently cursor is visible that is a text view and its not clickable or editable
Image 1 Multi Screen
Image 2 Single Screen
I try multiple Multiple things like setFocusable(false); clearFocus(); but its not working even I can
isCursorVisible = false // this gonna work but after that I'm not able to select the text
CodePudding user response:
After Long Scrolling the android documentation i find out the answer.
override fun onResume() {
super.onResume()
requireActivity().currentFocus?.clearFocus()
}
Try to clear the current focus of your current view will sort this problem