Reputation: 11164
How can you get and set the editable value (true/false) of a EditText object?
Upvotes: 0
Views: 983
Reputation: 28418
In Android EditText
does not operate with "editable" concept. Instead, in addition to "focusable"/"non-focusable", it can be "enabled"/"disabled":
boolean EditText.isEnabled()
void EditText.setEnabled(boolean enabled)
Upvotes: 1
Reputation: 14201
Try this (but there might be a better approach):
To prevent someone editing content in the EditText:
EditText comment = (EditText)findViewById(R.id.txt_comment);
comment.setEnabled(false);
make it editable:
comment.setEnabled(true);
Then to check whether it's editable:
comment.isEnabled()
Upvotes: 2
Reputation: 4437
An EditText
is always editable. There is no way to get the editable value from a EditText
.
Upvotes: 1
Reputation: 46943
This is combination of the properties getFocusable
and getEnabled
, though in some cases it might be that just getEnabled
can do the trick for you.
Upvotes: 1