Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AlertDialogUtils {
- fun init(context: Context, msgStringId: Int, listener: AlertDialogListener) {
- val builder = AlertDialog.Builder(context)
- builder.setMessage(msgStringId)
- .setPositiveButton("Yes") { _, _ ->
- listener.onClickPositive()
- }
- .setNegativeButton("No") { dialog, _ ->
- dialog.cancel()
- }
- .create()
- .show()
- }
- interface AlertDialogListener {
- fun onClickPositive()
- }
- }
Add Comment
Please, Sign In to add comment