https://kotlinlang.org logo
z

ziv kesten

09/01/2022, 3:41 PM
Does anyone know of any reason
BackHandler
might not be intercepting back press? I am using it in a fragment:
Copy code
@AndroidEntryPoint
class MyFragment : BaseFragment() {

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return ComposeView(requireContext()).apply {
            setContent {

            BackHandler {
                    // not called when back press
                   someAction()
            }
        }
c

Chris Fillmore

09/01/2022, 6:23 PM
This is one situation where BackHandler is not invoked. Not sure if it applies to your situation: https://issuetracker.google.com/issues/201909853
z

ziv kesten

09/04/2022, 6:46 AM
Unfortunately no, i am not using a DialogFragment, thank you
83 Views