E
E
Eserchik2015-08-06 18:29:13
Android
Eserchik, 2015-08-06 18:29:13

Android. When you receive a photo from the camera, do 2 identical files appear in the DCIM folder?

Hello everyone, I've run into this problem.
Activity->Fragment->FragmentDialog->Getting a snapshot from the camera
The task is to get a snapshot from the camera and write the file to the folder "/storage/sdcard0/DCIM/Camera/TrashmanTmp/", with my name.
What happens is that when you receive a picture from the camera, 2 identical files appear in the "/storage/sdcard0/DCIM/Camera/" folder, with a standard name (they have the same names with a difference in the increment ...-1) and the file that I need in the "TrashmanTmp" folder with my name.
The camera call code is standard:

static final int REQUEST_TAKE_PHOTO = 100;

Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
                       File dir = new File("/storage/sdcard0/DCIM/Camera/","TrashmanTmp");
           if(!dir.exists()) {
                dir.mkdirs();
            }else{
            	DeleteRecursive(dir);
            	dir.mkdirs();
            }

            File mypath = new File("/storage/sdcard0/DCIM/Camera/TrashmanTmp/",description+".jpg");
                        takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(mypath));
            startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
        }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question