There is an EditText into which we have to enter a number, and then, depending on the number, we have to output this or that fragment. But I don’t know how to do it, I have never come across it.

There should also be a check, which excludes the possibility of entering letters. I hope, who knows how to implement it.

    1 answer 1

    you get the number and then use the switch-case conditional transfer switch-case or if insert the necessary fragment.

    As for input validation, you can only use a numeric keyboard, setting it in the EditText properties, but this does not protect against all input errors, for example, the user can enter a non-integer number, the validator based on regexp will be best

    • Well, fractional numbers, in principle, are also suitable for me, since the user enters a number, and this number is in the range - alex11