4
votes

I have following in my app:

layout/dialog_edit_group.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/dlgEditGroup"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent">
<EditText android:id="@+id/txtGroup"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:hint="Group Name"
          android:inputType="text"
          android:singleLine="true"
          android:editable="true"/>

my activity (onCreateDialog method):

        ...
        LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.dialog_edit_group, (ViewGroup) findViewById(R.id.dlgEditGroup));
        EditText txtGroup = (EditText) layout.findViewById(R.id.txtGroup);
        txtGroup.setFocusable(true);
        builder.setView(layout);
        return builder.create();

When dialog appears and I try to type text - edit text not updates. Keyboard shows that keys are pressed (I see keyboard hints - I use gingerbread keyboard), but nothing changes in edittext. What I need to do?

UPD: see video with issue: youtu.be/XOSXDSZvisI

5
addition: on each key press in logcat adding next: WARN/IInputConnectionWrapper(2517): commitText on inactive InputConnectionnewmindcore

5 Answers

0
votes

Have you tried setting the EditText to focusable AFTER adding the view?

0
votes

setFocusable(true); just makes the widget focusable and in the case of EditText is focusable by default.

Try requestFocus() instead.

0
votes

I have got this error on my HTC Desire too, but when I wait about 1-2 min, all edittext work normal after some system os log. So, I think problem is not your code.

0
votes

For those still looking for this answer, I solved my problem by setting color of EditText to BLACK

editText.setTextColor(Color.BLACK);
0
votes

The main reason behind this is maybe in your manifest file

The main problem is with this line in your manifest file:

<application android:hardwareAccelerated = "false">

To make the text you have typed to be updated in the editText field remove this line in your manifest file:

android:hardwareAccelerated = "false"

(or)

Modify the line as:

android:hardwareAccelerated = "true"

I am answering this question late, but I hope that maybe it would be useful for who are still facing this problem.