79391945

Date: 2025-01-27 19:28:01
Score: 1
Natty:
Report link

Kotlin.

Add the following to MainActivity.kt:

override fun onCreate(savedInstanceState: Bundle?) { ... ...

    supportFragmentManager.addOnBackStackChangedListener {
        supportFragmentManager.fragments.lastOrNull()?.onResume()
    }

}

Then, add to AnyFragment.kt:

override fun onResume() {
    super.onResume()
    //txtEdit.requestFocusFromTouch()
}

Now, the onResume() will be called when the Fragment got the focus.

Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: David Chai