I want to use different onKeyDown or onKeyUp in different fragment,but the method is written in the activity.So I want to find a way to write different onKeyDown.
Use FragmentManager
's findFragmentById()
to check what fragment is currently displayed, and switch
for the fragment inside the onKeyDown
function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With