2

I have a ListView which contains EditTextas items and also EditText in ListView header.

enter image description here

When I tap on any EditText it shows the keyboard and allows me to enter text. But if I press the back button, it hides the keyboard and then tap on the EditText which was previously focused, does not open the keyboard.

Here is my EditText declared in xml

<EditText
    android:id="@+id/ui_row_create_poll_edit_text_txt_name"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_marginLeft="@dimen/margin_normal"
    android:layout_toLeftOf="@id/ui_row_create_task_user_info"
    android:background="@android:color/transparent"
    android:imeOptions="actionNext"
    android:maxLength="@integer/task_length"
    android:maxLines="1"
    android:paddingBottom="@dimen/padding_large_plus_little"
    android:paddingLeft="@dimen/padding_large_plus_little"
    android:paddingTop="@dimen/padding_large_plus_little"
    android:textColor="@color/black"
    android:textSize="@dimen/font_very_large" />

I have tried added onFocusedchanged listener and onTouchListener but it doesn't work.

I have also tried to add the onClickListener and added the following code to display keyboard forcefully but this does not work either.

 InputMethodManager inputMethodManager = (InputMethodManager) context.
    getSystemService(Context.INPUT_METHOD_SERVICE);
 inputMethodManager.showSoftInputFromInputMethod(windowToken, 0);

It works fine on < Android-7.0, but causes problem in API 24.

Is there any specific changes in Android 7.0 related to EditText? Or can somebody come up with some solution?

Note: I am facing this issue only on Android-7.0. On previous version it works fine. Also I have faced another issue which is also only occurring on 7.0

Community
  • 1
  • 1
SAIR
  • 1,121
  • 11
  • 31
  • Possible duplicate of [Focusable EditText inside ListView](http://stackoverflow.com/questions/2679948/focusable-edittext-inside-listview) – Anjali Oct 06 '16 at 10:05
  • @Anjali: there is no issue with focus. issue is that it does not open the keyboard. EditText has the focus and cursor is there but keyboard is not opened – SAIR Oct 06 '16 at 13:11

1 Answers1

0

I am answering my question to close this issue. I just received an update patch for Android 7.0 and now it is working fine. It seems like it was a bug in 7.0 which is resolved in security path 5th October 2016.

SAIR
  • 1,121
  • 11
  • 31