Search code examples
androidandroid-edittextautocorrect

Why does EditText not show autocomplete/autocorrect suggestions on some devices?


I have an editable field which on most devices shows the keyboard auto correct options. However, on an LG with Android 5.0.2 the keyboard doesn't show autocorrect suggestions as the user is typing. Other apps like Whatsapp do show the autocorrect suggestions. What is missing from the inputType attribute?

    <EditText
        android:id="@+id/user_input_edit"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:fadeScrollbars="false"
        android:hint="@string/global_footer_hint"
        android:inputType="textMultiLine|textCapSentences|textAutoComplete|textAutoCorrect"
        android:maxLength="@integer/post_max_len"
        android:maxLines="4"
        android:minLines="1"
        android:scrollbars="vertical"
        android:textColor="@color/white"
        android:textColorHint="@color/grey_005"
        android:textCursorDrawable="@null"
        />

UPDATE: Following the suggestions I created a sample test at https://gitlab.com/gradha/Stackoverflow46421849, a simple app with some EditText widgets, each with a different setup. On most devices all fields show the autocomplete suggestions of the soft keyboard, but on this particular old Android only the deprecated autoText field suggested by Nongthonbam Tonthoi works as intended. Looks like this could be an implementation bug.


Solution

  • Try adding:

    android:autoText="true"
    

    to your EditText

    But this might not work on an emulator.