Saving multiple bitmaps sequentially. ACTION_GET_CONTENT "Recent" sort order of the folder?

So, I'm trying to write multiple bitmaps sequentially using a for loop, and I want them to appear in sequential order in the ACTION_GET_CONTENT

Recent folder of the image bin. However, every time I save them, they seem to be messy.

The file names are sequential, as is the exif data for each image, but they still appear out of order. I am using android.support.media.ExifInterface

to write exif data and I am writing the following exif tags:

long timeInMilli = System.currentTimeMillis();
long milliSec = timeInMilli % 1000;

DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh-ss-SSS");
String filename = dateFormat.format(timeInMill) + croppedFileUri.getLastPathSegment();

String exifDate = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss").format(timeInMill);

exif.setAttribute(ExifInterface.TAG_DATETIME, exifDate);
exif.setAttribute(ExifInterface.TAG_DATETIME_ORIGINAL, exifDate);
exif.setAttribute(ExifInterface.TAG_DATETIME_DIGITIZED, exifDate);
exif.setAttribute(ExifInterface.TAG_SUBSEC_TIME, String.valueOf(milliSec));
exif.setAttribute(ExifInterface.TAG_SUBSEC_TIME_ORIGINAL, String.valueOf(milliSec));
exif.setAttribute(ExifInterface.TAG_SUBSEC_TIME_DIGITIZED, String.valueOf(milliSec));

      

I've tried a few things like writing exif data split in two in each image ( .format((timeInMilli-milliSec)+i*1000)

) which wrote each exif data image to be split in two. However, in the Recent folder, the images still looked out of order. I also tried to place MediaScannerConnection.scanFile

both after the for loop (as an array of paths) and during each iteration for individual images (as a new array with a single path for the current image), but no luck.

What am I missing?

Here is a screenshot of the "Recent" folder used when selecting an image. I made a bunch of bitmaps with 1-10 numbers on them. In the screenshot, you can see how it loads images starting at 5-10, after which it displays 1-4. I am trying to get them to load sequentially from 1 to 10.

enter image description here

+3


source to share





All Articles