Skip to content

Instantly share code, notes, and snippets.

@joshskeen
Created March 29, 2017 20:40
Show Gist options
  • Save joshskeen/7be787a85c046e09fafa082ea06ad42f to your computer and use it in GitHub Desktop.
Save joshskeen/7be787a85c046e09fafa082ea06ad42f to your computer and use it in GitHub Desktop.
apply trick
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return ProgressDialog(context).apply {
setMessage(arguments.getString(ARG_MESSAGE))
setProgressStyle(ProgressDialog.STYLE_SPINNER)
}
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = ProgressDialog(context)
val message = arguments.getString(ARG_MESSAGE)
dialog.setMessage(message)
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER)
return dialog
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment