124697
124697

Reputation: 21893

Load images from gallery in the order the images were taken?

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.

Upvotes: 0

Views: 86

Answers (1)

Geobits
Geobits

Reputation: 22342

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.

Upvotes: 1

Related Questions