When I press the back button on my Android phone it closes the soft keyboard, but when calling onbackpressed method it doesn't close the soft keyboard
I have tried to close the soft keyboard programmatically, but I could not solve the problem exactly
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
if (imm.isAcceptingText){
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
android.R.id.accessibilityActionHideTooltip
}*
I want to close the soft keyboard while calling the onbackpressed method, How exactly does the back button work in Android?
If I call the onbackpressed method I need to close the soft keyboard programmatically, I need to avoid that closing keyboard code