Ok, so I was wondering if I can set the InputFilter of a textfield to INTEGER and also let it write only numbers from 00 to 23 (yeah, for hours)... I was thinking of restricting the first digit beeing above 2 and if it is 2 to restrict the second digit of going above 3, but I don't have any idea of how to do that. I tried with regex, but as I'm kind of a novice in programming, it didn't work for me.
Here's the piece of code in which i restrict the textfield with regex. As it is, it let's me write only numbers, but I would like to make it write only numbers ranged from 00 to 23.
- String txt = tb_SHH.get(Textfield.class, " HH").getText();
- txt = txt.replaceAll("\\D+", "");
- tb_SHH.get(Textfield.class, " HH").setText(txt);
Can you guys please tell me what to modify?
1