Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to display list in descending order using query() in stead of rawQuery()? android

Tags:

android

I try to user the following code to display my list in a descending order order by KEY_TIME, but it doesn't work, I tried rawQuery as well, but the program dead after I run it, please help me find the mistake, thanks!

   return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
    KEY_BODY, KEY_TIME, KEY_CATEGORY, KEY_ALARM}, null, null,null,KEY_TIME+"DESC",null);
like image 581
Tony Avatar asked Dec 03 '22 07:12

Tony


1 Answers

Try this code,

return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
        KEY_BODY, KEY_TIME, KEY_CATEGORY, KEY_ALARM}, null, null,null,null,KEY_TIME+" DESC");
like image 151
Mohammed Azharuddin Shaikh Avatar answered Dec 05 '22 19:12

Mohammed Azharuddin Shaikh