Skip to content

Instantly share code, notes, and snippets.

@alaershov
Created March 19, 2019 09:28
Show Gist options
  • Save alaershov/99c7dedf1ff63cf82c03a503dff9721e to your computer and use it in GitHub Desktop.
Save alaershov/99c7dedf1ff63cf82c03a503dff9721e to your computer and use it in GitHub Desktop.
Back press handling
override fun onBackPressed() {
val fragment = supportFragmentManager.findFragmentById(R.id.layout_container)
if (fragment != null
&& fragment is BackButtonListener
&& fragment.onBackPressed()) {
return
} else {
super.onBackPressed()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment