I am using this code to load images from my phones gallery: MultiImageChooser
It works well but the images load in reverse order of when they were created. Can someone look at the look and tell me:
I have been trying to figure it out for an hour but it seems to be complicated.
It's not in the ImageFetcher
class, but the MultiImageChooserActivity
class.
If you take a look at onCreateLoader()
, you'll see this line:
cl = new CursorLoader(MultiImageChooserActivity.this, MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
img.toArray(new String[img.size()]), null, null, null);
The last parameter of that constructor is sortOrder
. This is a standard SQL ORDER BY
clause you can use to sort it with. With null passed in, it defaults to sorting by display name. You'll probably want to use DATE_TAKEN
, ascending.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.