hi i want set limit for my text edit in kotlin
please help...!
i want set 3 digit number for each of this inputs
var num1=edt_no.text
var num2=edt_ntw.text
var num3=edt_nth.text
var num4=edt_f.text
when{
edt_no.text.isEmpty() -> txt_res.text="First is empty"
edt_ntw.text.isEmpty() -> txt_res.text="second is empty"
edt_nth.text.isEmpty() -> txt_res.text="third is empty"
edt_f.text.isEmpty() -> txt_res.text="Fourth is empty"
else -> calc(num1,num2,num3,num4)
}
You need 2 attributes for each EditText
:
android:maxLength="3"
android:inputType="number"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.