0

I wanted to create some folders and some files to /storage/MyFolder/. I had tried to work on using /storage/emulated/0/MyFolder and it is working but i want to make hide under the storage root folder.

Is there any possible way for me to do this?

5
  • Try naming it .MyFolder... Commented Oct 1, 2018 at 3:12
  • Hi I'L'l thanks for the reply, i do know using .MyFolder will hidden file but is there anyway that i can create the folder like the directory "/storage/MyFolder" ? I don't want that user can be find it easily Commented Oct 1, 2018 at 3:34
  • try this tutorial...... dev2qa.com/android-read-write-external-storage-file-example Commented Oct 1, 2018 at 3:43
  • you should not hide any files from user in the user-accessible storage. If you want to secure files from the user, use internal storage. Commented Oct 1, 2018 at 5:04
  • Hi @VladyslavMatviienko you are right Thanks for reply. Commented Oct 1, 2018 at 7:59

2 Answers 2

1

You can create folder like this in External Storage directory:

String folder_main = "NewFolder"; File f = new File(Environment.getExternalStorageDirectory(), folder_main); if (!f.exists()) { f.mkdirs(); } 
Sign up to request clarification or add additional context in comments.

Comments

0
//get path to external storage (SD card) String iconsStoragePath = Environment.getExternalStorageDirectory() + "/Abc/"; File sdIconStorageDir = new File(iconsStoragePath); //create storage directories, if they don't exist if(!sdIconStorageDir.exists()){ sdIconStorageDir.mkdirs(); } 

2 Comments

your answer is right , you just need to add check before this line if(!sdIconstorageDis.exists()) sdIconStorageDir.mkdirs();
Environment.getExternalStorageDirectory() is deprecated and should not be used anymore. Use context.getExternalFilesDir(String type) instead

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.