I am building a small Android app where the user will enter an IP address or a hostname into an EditText
widget. 90% of the time they will be entering an IP address, the rest of the time - a hostname.
So naturally, I want to make it easy for them to enter an IP address, but the ability to switch to alpha numerics for hostname entry is important.
I can't seem to find a good inputType. The numberDecimal
initially seemed like a good shot, but it only allows one dot.
Ideally, I'd like to start with a standard keyboard that had the ?123
button pressed.
How do I get there?
Try using android:inputType="number"
, but also set android:digits="0123456789."
. Works for me.