How to save image to external storage, but not save to internal

I don’t understand why people say that they are stored in external storage, because when I use this code and I check that my SD card does not have a file

Code This

OutputStream imageFileOS; int imageNum = 0; Intent imageIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); File imagesFolder = new File(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES), "Punch"); if(!imagesFolder.exists()){ imagesFolder.mkdirs(); // <---- } String fileName = "image_" + String.valueOf(imageNum) + ".jpg"; File output = new File(imagesFolder, fileName); while (output.exists()){ imageNum++; fileName = "image_" + String.valueOf(imageNum) + ".jpg"; output = new File(imagesFolder, fileName); } Uri uriSavedImage = Uri.fromFile(output); imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage); 

when I run the code and check it has a file in "Internal Memory / Pictures / Punch / image_0.jpg", but not see in SD CARD (SD CARD = external memory card 16 GB) Please help me ..

+4
source share
1 answer

I think you are confused by what getExternalStorageDirectory does.

It receives the main storage directory specified by the device manufacturer. This is usually "sdcard". "External_sd", as indicated in your comment, is the secondary repository directory that will not be returned in this method.

This is still not secure internal storage, and it can be installed and retrieved using a PC when connected.

From android docs:

Note. Do not confuse the word "external" here. This directory is best viewed as a media / shared drive. This is a file system that can store a relatively large amount of data and all applications (do not apply permissions). Traditionally, this is an SD card, but it can also be implemented as built-in storage in a device that is different from secure internal storage and can be mounted as a file system on a computer.

+2
source

All Articles