'Android: TextInputEditText used for IP

Good Morning everyone.

In my android app, I have a TextInputEditText (com.google.android.material.textfield.TextInputEditText) that I use for IP. I added the attributes:

                android:inputType="number|numberDecimal"
                android:digits="0123456789."

Usually everything works fine on smartphones, the user can write the ip and I have a TextWatcher that will validate the ip. If the ip is not valid, the 'OK' button is disabled. The user can only write numbers and points. The user can obviously write more points (an IP contains 3 points, like 127.0.0.1).

The only problem is on Android TV that things get a little weird. In particular, only the first point is visible. But the others are somehow 'memorized'.

To explain better, let's say the user use the D-Pad to write, and write '1.1.1.1' using the virtual keyboard, then he will see only '1.111'. But after clicking ok in order to close the keyboard, the IP is correctly displayed as '1.1.1.1'. So, more than a technical problem, is a bad user expierence.

Does someone have some suggestion how to improve the user expierence? Is there some specific inputType for IPs?

Thanks everyone



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source