000000000000000000000
000000000000000000000

Reputation: 1467

Android directory system

I am a little unsure on how to store and load files on Android.

I know that Assets are stored in file:///android_assets/, but this directory is exclusive to every application and read only, right?

Where can/ should I store files that are created on runtime and are exclusive to their app/ should be shared between apps?

Upvotes: 0

Views: 54

Answers (2)

Henry
Henry

Reputation: 43738

Check out the documentation of the Context class. It has several methods that return directories where to put files depending on their nature (private, media, cache, ...).

Upvotes: 2

Jimit Patel
Jimit Patel

Reputation: 4297

In your Manifest file use -

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Then to access external storage use one of methods from the class Environment -

getExternalStorageDirectory()
getExternalStoragePublicDirectory(String type)

Upvotes: 2

Related Questions