Joining cursors and sorting

前端 未结 1 411
星月不相逢
星月不相逢 2021-01-24 11:41

I\'m writing a \"gallery-type\" app for Android. In the \"master activity\", I have a GridView which I want to load/fill with thumbnails from photos on the device. So I\'ve writ

相关标签:
1条回答
  • 2021-01-24 12:09

    Hah, it seems one can "trick" Android into allowing CursorJoiner with descending sort by simply ordering by ID*(-1) (ascending):

    Cursor c_thumbs = getContext().getContentResolver().query(
                    baseUri, 
                    MS_proj_thumbs_array, null, null, 
                    "(" + PhotoContract.ThumbEntry.COLUMN_IMAGE_ID + "*(-1))"  // NB!
           );
    

    So that solves my problem; newest images on top!

    See full answer here: Querying the MediaStore: Joining thumbnails and images (on ID)

    0 讨论(0)
提交回复
热议问题