android kotlin Avoid passing null as the view root AlertDialog
val builder = AlertDialog.Builder(requireContext())
val inflater = requireActivity().layoutInflater
val view = inflater.inflate(R.layout.your_layout, null)
builder.setView(view)
.setTitle("Your Title")
.setMessage("Your Message")
.setPositiveButton("OK") { dialog, _ ->
// Your positive button logic here
dialog.dismiss()
}
.setNegativeButton("Cancel") { dialog, _ ->
// Your negative button logic here
dialog.dismiss()
}
val dialog = builder.create()
dialog.show()