Skip to content

Instantly share code, notes, and snippets.

@Alec-DeSouza
Created July 8, 2018 22:36
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 Alec-DeSouza/18519921b70fabbf0978718b3701b3b5 to your computer and use it in GitHub Desktop.
Save Alec-DeSouza/18519921b70fabbf0978718b3701b3b5 to your computer and use it in GitHub Desktop.
DialogFragment that retains data on rotation
open class RotatableDialogFragment : DialogFragment() {
init {
retainInstance = true
}
// Fixes rotation bug with dialog fragments
override fun onDestroyView() {
if (retainInstance) {
dialog?.setDismissMessage(null)
}
super.onDestroyView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment