-2

How can I hide a folder in android? I am downloading some data from the app which must be accessible only through my application. Currently, I am hiding folders by putting "." extension to the folder name and saving it in the app directory. But it will get visible when switching on "show hidden option" in file managers and enter the particular app data. Kindly suggest some methods by which we can hide data similar to what we see in amazon prime application and all.

Nivedh
  • 971
  • 1
  • 8
  • 19

3 Answers3

1

Unless the user roots their device all internal files are accessible only to your app. Beyond that, there is no use case and no acceptable reason to hide files from the person who actually owns the device.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
1

Hiding a folder in android not using “.” extension

you can use internal storage as an alternative to hide the folder, if the device is rooted don't allow the app to be installed, if the user roots the device after app install no matter what you do things will be accessible.

//Create internal dir;
File mydir = context.getDir("DIR_NAME", Context.MODE_PRIVATE); 
Aniruddha K.M
  • 7,361
  • 3
  • 43
  • 52
0

Currently solved my issue by saving files to Internal Storage. We can use either

File file = new File(context.getFilesDir(), filename);

or

File mydir = context.getDir("DIR_NAME", Context.MODE_PRIVATE); 

for saving it in internal directory.

But if rooted device the issue will persist

Nivedh
  • 971
  • 1
  • 8
  • 19