Skip to content

Instantly share code, notes, and snippets.

@k0siara
Created November 5, 2022 21:15
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/e46f13bcae015a98e34075d91e328bfc to your computer and use it in GitHub Desktop.
Save k0siara/e46f13bcae015a98e34075d91e328bfc to your computer and use it in GitHub Desktop.
NoticeDialogFragment.kt
class NoticeDialogFragment : DialogFragment() {
internal lateinit var listener: NoticeDialogListener
interface NoticeDialogListener {
fun onDialogPositiveClick(dialog: DialogFragment)
fun onDialogNegativeClick(dialog: DialogFragment)
}
override fun onAttach(context: Context) {
super.onAttach(context)
try {
listener = context as NoticeDialogListener
} catch (e: ClassCastException) {
throw ...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment