Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide a folder using programmatically in android, and access there file.

Tags:

java

android

I am developing android application which having some external files. I want to hide these files. Can we access hidden file in my app. Example I have many of images which will be use in my app. I want to hide these file but access only using my app.

like image 751
Arshad Avatar asked Mar 21 '16 05:03

Arshad


People also ask

How do I find hidden files in android programmatically?

Hit the three vertical lines at the top left. Tap “Settings.” Enable (to show) or disable (to hide) the “Show hidden files” option. That's it.

How do I hide a specific folder?

Launch File Explorer and navigate to the location of the targeted file or folder. Click on the file/folder and choose Properties from the context menu. In the Properties dialog, head over to the General tab and checkmark the box associated with Hidden under the Attributes section. Click Apply > OK.


3 Answers

Just put a . in front of your folder name than it becomes a hidden folder

like image 63
Rohit Heera Avatar answered Oct 23 '22 14:10

Rohit Heera


Android is multi user linux system, so if you create folder starting with dot, it'll be hidden.

So store folder starting with dot

for example

File folder = new File(Environment.getExternalStorageDirectory(), ".hiddenFolder");
folder.mkdir();

and store all images in this folder and access images in your app from same folder.

like image 27
ELITE Avatar answered Oct 23 '22 14:10

ELITE


Create a folder with a . (dot) before its name, and add an empty .nomedia file inside it. (.(dot)nomedia - exactly as I typed it) and add your files ands images there.

Now other Apps like Gallery will ignore these images. That's the only way that I think this can be done.

E.g.: folder name: .images

which includes an empty file .nomedia

like image 2
mantlabs Avatar answered Oct 23 '22 14:10

mantlabs