Android : Soft input layout doesn't change as intended

on Tuesday, September 2, 2014


I have a problem with my android soft input layout.


What I need is a phone layout which only accepts numeric values. I have done this before by modifying xml:



android:inputType="phone"
android:digits="0123456789"


and it worked like a charm.


Now the current EditText is generated dynamically, and I have to do it programmatically.


I've already tried



mEditTextET.setInputType(InputType.TYPE_CLASS_PHONE | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
mEditTextET.setKeyListener(DigitsKeyListener.getInstance("0123456789"));


but it shows text layout instead of phone layout.


Any ideas?


0 comments:

Post a Comment