E.g. I have similar code to this post Show AlertDialog if some condition is met
if (condition) {
AlertDialog.Builder(requireActivity())
.setTitle("Internet")
.setMessage("Internet ON")
.setPositiveButton("ok!",null)
.create()
} else {
AlertDialog.Builder(requireActivity())
.setTitle("Internet")
.setMessage("Internet OFF")
.setPositiveButton("ok!",null)
.create()
}
But can I do the check for conditions met inside the message for dialog? So that I do not rewrite same code twice, but with different message