I am facing problem with enabling an edittext box at initialisation. I have disabled my editbox like so: text_edit.setFocusable(false);
Later, I want to enable the textbox via the click of a checkbox.
The textbox is not being enabled, here is my click event code:
if(((CheckBox) v).isChecked()) {
Toast.makeText(User_name_search .this, "Selected", Toast.LENGTH_SHORT).show();
text_edit.setFocusable(false);
//checkbox.setChecked(false);
} else {
Toast.makeText(User_name_search .this, "Not Selected", Toast.LENGTH_SHORT).show();
text_edit.setFocusable(true);
}
What am I doing wrong?
You should use
setOnClickListenerorsetOnCheckedChangeListenerfor the checkbox, and when somebody clicks, you should changesetfocusable.