Reputation:
I'm using the following code ,it picks image from gallery and displays image in random order
String[] columns = { MediaStore.Images.Media.DATA, MediaStore.Images.Media._ID };
String orderBy = MediaStore.Images.Media._ID;
imagecursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null,null, orderBy);
int image_column_index = imagecursor.getColumnIndex(MediaStore.Images.Media._ID);
I want the images to get sorted via date it has been taken(Eg:Latest ones first and oldest photos later)...
and one more problem that when i use above code it only loads images in DCIM folder ,i want all the images from phone also.......
Upvotes: 4
Views: 2371
Reputation: 14226
Change orderBy
to
String orderBy = MediaStore.Images.Media.DATE_TAKEN + " DESC";
Upvotes: 7