Friday, November 4, 2011

[android-developers] Sort order from content resolver

Using content provider for contacts and can't seem to find a way to
sort display_names without regard to case. For example the names
"Able, Apple, agnostic" will sort as "agnostic, Able, Apple". My
desire
is to ignore case and have them sort as "Able, agnostic, Apple" which
is
what is actually done by the default contacts app.

Here is the query:

Context.getContentResolver().query(Data.CONTENT_URI, projection,
selection, null, "upper(display_name) asc");

Note the last parameter (sort order) of "upper(display_name) asc".
This is one variation that
I have tried that doesn't seem to work. Among others I have also
tried "display_name asc",
"display_name collation nocase", "display_name collation nocase asc",
all to no avail.

I have looked for a "sort" column but have not discovered one yet.

Any suggestions or ideas would be welcome. Thanks.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment