I want to make Auto complete TextView Editable or not editable according to my condition.
I made Autocomplete text view as Editable
constituency.setEnabled(true);
constituency.setInputType(InputType.TYPE_CLASS_TEXT);
constituency.setClickable(true);
but it's not working.
can anyone please help me?
To disable an EditText
(autocomplete or not) use editText.setInputType(0)
. See my answer in this post.
For re-enabling that EditText
inquire the value of the input type prior to disabling it, save it in a variable, for example in int safe = editText.getInputType()
and put the variable back in its place like so: editText.setInputType(safe)
. In order to regain focus, add editText.clearFocus()
and editText.requestFocus()
.
may be you are looking for this one.
education.setKeyListener(null);
for setting it back just put it in some method and call
education.setKeyListener(TextKeyListener.getInstance());
You can just set constituency.setEnabled(boolean)
, to true or false.
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