Intrusive Camera Behavior

I call the intent MediaStore.ACTION_IMAGE_CAPTURE using MediaStore.EXTRA_OUTPUT to save the image file.

In onActivityResult, I can verify that the image is saved to this correct file. The strange thing is that in any case, the image is also saved in a file named something like "/sdcard/Pictures/Camera/1298041488657.jpg" (the era in which the image was executed).

I checked the source of the camera application (froyo-release branch), and I'm almost sure that the code path is correct and there would be no need to save the image, but I'm noob and I'm not quite sure. AFAIK, the image saving process starts with this callback (my comments):

private final class JpegPictureCallback implements PictureCallback {
...
   public void onPictureTaken(...){
       ...
       // This is where the image is passed back to the invoking activity.
       mImageCapture.storeImage(jpegData, camera, mLocation);
       ...

       public void storeImage(final byte[] data,
               android.hardware.Camera camera, Location loc) {
           if (!mIsImageCaptureIntent) {      // Am i an intent?
               int degree = storeImage(data, loc); // THIS SHOULD NOT
BE CALLED WITHIN THE CAPTURE INTENT!!
            .......

      // An finally:
       private int storeImage(byte[] data, Location loc) {
           try {
               long dateTaken = System.currentTimeMillis();
               String title = createName(dateTaken);
               String filename = title + ".jpg";  // Eureka,
timestamp filename!
                ...

, , "storeImage (, loc);" , ...

, , . , 20 , , sdcard:)

Nexus One Froyo, Huawei U8110 Eclair.

- ?

.

+2

Source: https://habr.com/ru/post/1786053/


All Articles