Skip to content

Instantly share code, notes, and snippets.

@k0siara
Last active May 16, 2023 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k0siara/a5523f60e791369132f0c0e9d1b63910 to your computer and use it in GitHub Desktop.
Save k0siara/a5523f60e791369132f0c0e9d1b63910 to your computer and use it in GitHub Desktop.
SafeUseOfFragmentManager.kt
fun confirmStartGame() {
val fm = supportFragmentManager
if (fm.isStateSaved) return
    val newFragment = StartGameDialogFragment()
    newFragment.show(newFragment, "game")
}
@arunsudharsan
Copy link

arunsudharsan commented May 16, 2023

The last statement should be:

newFragment.show(fm, "game")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment