• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Is there any way to have android:inputType="numberDecimal" and still allow text content?

Zerq

Lurker
Is there any way to have android:inputType="numberDecimal" and still allow text content?
I've looked everywhere to set this as a soft default.. i.e it would allow the user to switch back to text.

so far i've seen no tutorial on getting a edittext to behave this way.

is there a way of doing this?
 
numberDecimal does'nt allow text, if you want to check something you can also go for a normal text box and use a tryparse for when it would be a decimal.
 
to clarify the field in question should in most cases be unput numericaly... but sometimes there are exceptions to this...

and in those cases i want the user to be able ot togle to text mode instead and be able to input regular text
 
to clarify the field in question should in most cases be unput numericaly... but sometimes there are exceptions to this...

and in those cases i want the user to be able ot togle to text mode instead and be able to input regular text

Set field to textfield.
You can use a try/catch to parse the fieldinfo if you cant parse it it's text else it's a decimal.
 
Back
Top Bottom