Android New Image has strange numbers on the end of the file name

后端 未结 2 1123
闹比i
闹比i 2021-01-19 16:07

I\'m writing a camera2 app in android and when I try to save the image, something adds extra numbers on the end of the filename before the \'.jpg\'

I have a feeling

2条回答
  •  后悔当初
    2021-01-19 16:22

    Those random numbers are explicitly generated by createTempFile(), as seen in the source code.

    You probably don't want to use temporary files anyway, thus I'd recommend to create normal files:

    File image = new File(storageDirectory, imageFileName + ".jpg");
    

提交回复
热议问题