Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top