Creating directories in internal file stores

How do I create directories in internal storage?

I've tried this:

File file = getFilesDir();

      

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

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

Can anyone tell me how?

I also tried this:

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

      

It creates a folder, but it was created with "app_", so the directories become "/data/data/com.mypackages/app_myfiles". I do not want this because I cannot read the folder if there is "app_" in there.

0


source to share


1 answer


Under eye solution: D

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

      

With this code, I save in m_applicationDir the package directory (in your case, the file saved in the file). Then just create a subdirectory with images.



So m_picturesDir points to:

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

      

+2


source







All Articles