Hello! The considered EditText is for TIN input, therefore inputType = number. It is clear that you need to check the number of characters entered (in this case - numbers).

I check through editText.getText (). ToString (). Length () - honestly, I do not know.

But then a small ambush caught - the TIN may include 0 (zeros), which .length () does not take into account when counting the number of characters.

How to determine the number of characters with these zeros? Google did not help.

  • Your problem is definitely something else, because the length () method of the String class takes into account any characters, including '0'. Check first if you really get the line you are expecting. - Artilirium
  • I take the line from EditText in the right place at the right moment. Rechecked many times and in different ways. If you enter without zeros, everything works as it should. - Ayrat
  • I think the piquancy of the situation gives the attribute inputType = number. Because of it, at the getText stage, zeros can be discarded. This is an assumption. - Ayrat
  • Print the string to the log and make sure that the String object consists of the same characters that you entered. - Artilirium
  • Led, looked. You're right. Thanks you. The problem really was something else. Problem solved. - Ayrat

0