Skip to content

Instantly share code, notes, and snippets.

@dan085
Last active April 22, 2020 20:49
Show Gist options
  • Save dan085/9b6981ea1d5fd4ecc39c9593ead9383c to your computer and use it in GitHub Desktop.
Save dan085/9b6981ea1d5fd4ecc39c9593ead9383c to your computer and use it in GitHub Desktop.
//funcion en load_info
fun showMessageOKCancel_one(
ctx: Context,
title: String,
message: String,
okListener: Function1<MaterialDialog, Unit>
): MaterialDialog {
val a = MaterialDialog(ctx)
a.cancelable(false)
a.title(R.string.app_name, title)
a.message(R.string.app_name, message, false, 1.0f)
a.negativeButton(R.string.cancel, ctx.resources.getString(R.string.cancel), null) -----> aqui va el null para el caso de cancelar pedes agregar otro listener y editarlo en las declaraciónes de la función
a.positiveButton(R.string.ok, ctx.resources.getString(R.string.ok), okListener) ----> aqui va el listener en caso de aceptar
a.show()
return a
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment