How to hide photos from the gallery and save it in my application

I am developing an Android application where he will select some photos from the gallery and hide them,

I can select a specific picture from the gallery and save it in my application and delete it from the gallery, but a person can see these photos if he opens my application folder in the SD card, so how do I store them so that even if the person checks my SD card, then he will not be able to detect these photos?

+8
android android-image android-gallery
source share
6 answers

The only safe way to do this is to encrypt the image data yourself and delete the source files, leaving only your application able to decrypt the files.

See How to encrypt a file from an SD card using AES in Android? to find out how to do this.

As an additional step, you can also use any number of other answers to hide encrypted files.

+10
source share

If you want the gallery to not show images from the folder of your application, you can put a file named .nomedia .

Source: stack overflow

If you want to hide a folder from apperaring in, say, File Manager, make sure your folder starts with a period (.). For example, if the folder is called myfolder, it should be created as .myfolder

Source: stack overflow

Please note that the user can change the settings of the File Manager to display hidden files and a folder. There is no solution for this.

+6
source share

If you want to hide the folder, just add '.' as a prefix for the folder name.

+2
source share

If you want the gallery to not show images from the folder of your application, you can put a file named .nomedia in it.

If you want to hide a folder from apperaring in, say, File Manager, make sure your folder starts with a period (.). For example, if the folder is called myfolder, it should be created as .myfolder

File sdCard = Environment.getExternalStorageDirectory(); File dir = new File(sdCard.getAbsolutePath() + "/.myFolder" );

+1
source share

Take a look. which are performed with one more step. they also hide data as well as the folder.

How to hide folder in sdcard in android

0
source share

Use the path to your SD card folder as

 Environment.getExternalStorageDirectory().toString()+context.getPackageName+"//data//data//"+"(.folderName)"; 

this will ensure maximum security of your images, if the user phone is not rooted, this way is safe from all sides.

0
source share

All Articles