S.
03/13/2022, 8:57 PMKeyboardType.Number still allows special characters while android:inputType="number" doesn'tS.
03/13/2022, 9:02 PMRobert Menke
03/13/2022, 9:16 PMS.
03/13/2022, 9:19 PMonValueChange = {
input = it
inputError = input.toIntOrNull() == null
}
and enabled = !inputError on the buttonRobert Menke
03/13/2022, 11:09 PMAdrijan Rogan
03/14/2022, 6:09 AMNumberPasswordAdrijan Rogan
03/14/2022, 6:15 AMinput.toIntOrNull() will fail on larger numbers and remove leading zeroes. Instead, use input.filter { it.isDigit() } to allow all unicode number decimal digits. You can also allow only "standard" ASCII digits.S.
03/14/2022, 6:35 AMtoLontOrInt . Leading zeros are irrelevant for actual numbers anyways. If you want to work with phone numbers etc the filter option is the better choice ofcAdrijan Rogan
03/14/2022, 6:46 AMtoIntOrNull though