Hello guys.
I trying set EditText to input only numbers and point (” . “) that’s all. Im already using inputType.. but there numeric keyboard with “+”,”-” and “#” and without point/period (“.”)
example for what need it : 100.99 .. that’s all.
I found some code :
<EditText android:text="100.99"
android:id="@+id/EditText01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numeric="integer|decimal" />
but it’s in xml… i want create it by code. Also i mean this string :
android:numeric="integer|decimal"
Please if any one know how to set this settings by code.. reply me
Regards, Peter.
Try using:
Edit :
The suggestion i have given above was taken from Doc. but as you said it is not working properly,i can suggest you a more thing.
Add a TextWatcher to your EditText as below,after you set above input type: