fun Fragment.showAlertDialog(message: String? = null, title: String? = null, block: AlertDialogBuilder.() -> Unit = {}): Dialog?
Displays an alert dialog by creating a new AlertDialogBuilder using the title and message provided, then passing it to block with the builder as receiver.
Does nothing if the fragment isn't attached to an activity.
Example:
showAlertDialog("Danger zone?") {
positiveButton("yes") { _, _ -> deleteAll() }
negativeButton("no")
}
Return
Instance of displayed dialog.
fun Fragment.showAlertDialog(@StringRes messageResId: Int, @StringRes titleResId: Int = 0, block: AlertDialogBuilder.() -> Unit = {}): Dialog?
Displays an alert dialog by creating a new AlertDialogBuilder using the title and message string resource ids provided, then passing it to block with the builder as receiver.
Does nothing if the fragment isn't attached to an activity.
Example:
showAlertDialog(R.string.delete_everything) {
positiveButton(R.string.yes) { _, _ -> deleteAll() }
negativeButton(R.string.no)
}
Return
Instance of displayed dialog.