birraa
birraa

Reputation: 440

Where in Android file system are directories created?

I am working on Android app that has to save data to files. To make the files accessible for all apps and also transfer to computer through USB, the files should be saved in a folder called "ABC". I manually created the folder "ABC" on both external storage card and internal storage. I was able to get full path of that folder on external storage card through code and was able to write and read from it.

String path = Environment.getExternalStorageDirectory().toString() + "/ABC";

But the internal storage turns out to be more elusive because I could not get the full path of "ABC" folder on the internal storage. Is there a way to programmatically determine where folders are created on internal storage? Generally, under what partion are folders created on internal storage in Android?

Edit:
Internal storage - I mean non-removable storage
External Storage - I mean Removable storage

Upvotes: 0

Views: 121

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006574

I manually created the folder "ABC" on both external storage card and internal storage.

You might have created this directory on external storage. Unless you are testing on a device or emulator, you did not create this directory on internal storage, as you do not have access to it. A "card" would imply removable storage, which is something else entirely, for the vast majority of Android devices.

I was able to get full path of that folder on external storage card through code and was able to write and read from it.

Your code is for external storage. On very few devices is that a "card".

But the internal storage turns out to be more elusive because I could not get the full path of "ABC" folder on the internal storage.

There is no "ABC" folder on internal storage, insofar as you cannot create a /ABC directory off of the device root, or even off of /data. You can only work for your app's portion of internal storage, using methods like getFilesDir(). And, again, unless you are testing on an emulator or a rooted device, you have no means of creating such an "ABC" directory by hand.

Is there a way to programmatically determine where folders are created on internal storage?

Um, well, you are certainly welcome to examine the path in the File object that you created to point to some location (e.g., new File(getFilesDir(), "ABC")).

Generally, under what partion are folders created on internal storage in Android?

/data.

Upvotes: 1

Related Questions