When creating an EditText in the java portion of the application, how do you limit it to numbers like you would in the xml? For example:
new EditText(this);
set like
<EditText
android:id="@+id/h1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"/>
Something like this perhaps ?
EditText text = new EditText(this);
text.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With