kyuu
kyuu

Reputation: 237

Make directories in files internal storage

How do i make directories in internal storage?

I tried this:

File file = getFilesDir();

this makes me goes to folder "/data/data/com.mypackages/files/"

Then i want to make a folder again in that directories, let's say i want to make "myfiles" folder in there so it becomes, "/data/data/com.mypackages/files/myfiles/".

Can anyone tell me how?

I also tried this:

File file = getDir("myfiles", MODE_PRIVATE);

It makes the folder, but it was created with "app_", so the directories becomes "/data/data/com.mypackages/app_myfiles". I don't want that because i can't read the folder if it has "app_" in there.

Upvotes: 0

Views: 3222

Answers (1)

Davide Lorenzi
Davide Lorenzi

Reputation: 348

The solution is under your eyes :D

m_applicationDir = new File(this.getFilesDir() + "");
m_picturesDir = new File(m_applicationDir + "/pictures");

With this code, i save in m_applicationDir the dir of the package (in your case the dir saved in file). Then simply create a sub-directory named pictures.

So m_picturesDir points to:

/data/data/com.mypackages/files/pictures

Upvotes: 2

Related Questions