val input = EditText(requireContext())input.inputType = InputType.TYPE_CLASS_NUMBER // capture number onlyinput.setText("1")val builder = AlertDialog.Builder(requireContext()) .setTitle("Scroll To Page") .setView(input) .setPositiveButton(android.R.string.ok) { dialog, whichButton -> val position = input.text.toString().toInt() // do scroll to page } .show()
If you need a more complicated view, you can use a layout file.
You can also create a reusable class.