Search code examples
androidright-to-leftandroid-filterable

ListView missing random values when using 2 different String languages in adapter


I'm using AutoCompleteTextView to make the search easier for the user.

The search is possible at any language, but for this example I'll use English and Hebrew (RTL language).

As long as I'm using just one language (English or Hebrew) it's work fine, but when the suggestion pop up box has values of both languages it becomes weird.

enter image description here

You can see that between the "nicky jam" and the "zeamoon" Strings theres an empty line. I've debugged the ArrayList and there's a value in Hebrew which is not populated for some reason.

It becomes even weirder when you can see at the top there's a Hebrew string that populated just fine.

So, there's no conclusion "My adapter not populating any data containing Hebrew", it's just missing values randomly even though they exist.

PublisResult function:

@Override
            protected void publishResults(CharSequence constraint, FilterResults results) {
                if (results != null && results.count > 0) {
                    notifyDataSetChanged();
                    if (!instantAutoComplete.isPopupShowing())
                        instantAutoComplete.showDropDown();
                }else {
                    notifyDataSetInvalidated();
                }

            }

The only similar topic I've find is This, the guy used Arabic and faced kinda same behavior. In my case it's bit different because of the filter implementation.


Solution

  • I was facing same issue. In my case the issue was in xml file. I have used Urdu as RTL which was not showing in layout.