user1195614
user1195614

Reputation: 385

How to create sub folders in Android FileSystem

I have created a file in Android file system.For this i have written the below code

   openFileOutput("one.html",Context.MODE_PRIVATE);

using the code i have seen the file named "one.html" is created in Android FileSystem.The Absolute is as follows.

   /data/data/packagename/files/one.html

But now i need to create a folder named "html" inside the files directory.How can i create?

Upvotes: 2

Views: 4373

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006584

Use getFilesDir() to get a File object pointing at your application's internal storage (in your case, /data/data/packagename/files. From there, use standard Java I/O:

File subdir=new File(getFilesDir(), "whatever");

subdir.mkdirs();

Upvotes: 5

Related Questions