I been trying to get back my EditText back to editable programmatically but it simply does not work.
I looked at several threads and everybody is saying the same thing, but for whatever reason, it does not work for me.
I looked int this, but no success
Cannot change EditText back to being editable
Can anyone spot why my EditText never goes back to editable again? Once I disabled it and try to re-enabled it, the soft key never shows up again. Here's the code snap:
boolean enabled = true;
final Button button = (Button) findViewById(R.id.bnt3);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
enabled = !enabled;
EditText editView = (EditText) findViewById(R.id.popup_dlg_edit_text_id);
if (enabled) {
//BUG: this code never makes my EditText editable again :(
editView.setFocusable(true);
editView.setEnabled(true);
editView.setCursorVisible(true);
editView.setFocusable(true);
editView.setFocusableInTouchMode(true);
editView.setClickable(true);
} else {
editView.setFocusable(false);
editView.setEnabled(false);
editView.setCursorVisible(false);
editView.setKeyListener(null);
editView.setBackgroundColor(Color.TRANSPARENT);
}
}
});
my layout
<EditText
android:id="@+id/popup_dlg_edit_text_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@android:color/holo_green_light"
android:hint="@string/app_name"
android:inputType="textNoSuggestions"
android:maxLines="1"
android:textSize="@dimen/default_font_small" />