android - SQLite query using CursorLoader -



android - SQLite query using CursorLoader -

i trying unique column values in loader. code :-

public loader oncreateloader(int id, bundle args) {

if (mselectedspinneroption == 1) { homecoming new cursorloader(this, suggestion.content_uri, suggestion.projection, badbehaviourcolumns.packagename="distinct", null, badbehaviourcolumns.timestamp + " asc "); } }

i want values distinct bundle name values. how accomplish using above code?

i writing reply because faced exact same issue while querying cursorloader , got answers related database.query().

there simple trick can used on lines of sql injection. instead of using distinct, here grouping has been used works faster unless low on memory (ref: huge performance difference when using grouping vs distinct).

following query have execute distinct column1 items table_name.

select column1 table_name grouping column1;

with technique query end executing.

select column1 table_name (column1 not null) grouping (column1);

following implementation in android.

string selection = column1 + " not null) grouping (" + column1; cursorloader c = new cursorloader(this, uri, projection, selection, null, null);

android sqlite

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -