Android: Distinct and GroupBy in ContentResolver

Bostone picture Bostone · Feb 23, 2010 · Viewed 36.2k times · Source

What would be the correct way to add DISTINCT and/or GROUPBY to ContentResolver-based queries?

Right now I have to create custom URI for each special case.

Is there a better way?

(I still program for 1.5 as lowest common denominator)

Answer

kzotin picture kzotin · Dec 17, 2010

You can do nice hack when querying contentResolver, use:

String selection = Models.SOMETHING + "=" + something + ") GROUP BY (" + Models.TYPE;