Reputation: 36205
I am currently developing an App for Android. I am creating an Alert Dialog with input boxes and I need the input boxes to be numbers only but as a password input. How can I do this google isn't finding me anything only one or the other. This needs to be done programatically not using XML
Upvotes: 1
Views: 3488
Reputation: 14974
In your xml
<EditText
android:id="@+id/EditText01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:password="true"
android:digits="1234567890"
android:inputType="number"/>
the digits part makes it so you can't use symbols or any other characters, and this ensures that ONLY numbers will be entered. using the inputType="phone" method, parentheses and pound signs can still be entered
Upvotes: 1
Reputation: 1648
Edittext set for password with phone number input? (android)
<EditText
android:id="@+id/EditText01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:password="true"
android:inputType="phone" />
Upvotes: 3