Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't change InputType of EditText after I set it to TYPE_NULL

I set the InputType of an EditText to TYPE_NULL with:

editText.setInputType(InputType.TYPE_NULL);

I can set it to TYPE_NULL, it works! But if I want to set InputType to something else, like TYPE_CLASS_TEXT, it doesn't work!

How can I change it dynamically in code? Like to TYPE_NULL, then to TYPE_CLASS_TEXT and to TYPE_NULL again?

like image 739
Emrah Karakoc Avatar asked Nov 18 '25 16:11

Emrah Karakoc


1 Answers

To do this you first have to change the INPUT TYPE, then add text to it dynamically as follows.....

editText.setInputType(InputType.TYPE_CLASS_TEXT);
editText.setText("Hello");
like image 113
Navjot Avatar answered Nov 20 '25 08:11

Navjot