Accented chars not indexed properly on Android

147 views Asked by At

I have an Android app that shows an alphabetically ordered list of names. In spanish there are some names that starts with an accented character.

My implementation of AlphabetIndexer orders in this way:

A B C D E (regular ordering) .............. Á É ... (accented chars at end)

I don't want this ordering, i want not to discriminate names starting with accented chars (eg. index all words starting with á in the same section as regular a). I noticied that android stock contacts app does this well, but i've diving into the code and can't find anything interesting

1

There are 1 answers

0
webo80 On BEST ANSWER

I was using a loader with a cursor. In my query, I added "COLLATE LOCALIZED ASC" to the WHERE clause, and create a custom AlphabetIndexer which uses a collator with a SECONDARY strength.