mumayank
mumayank

Reputation: 1700

Should an extra file be placed in raw or assets folder?

I am working on an Android app project. It contains a file which contains a JSON. One can use it to mock the API call response during the development of the application.

Should I place that file in the raw folder or in the assets folder in the project?

If you answer, kindly provide reasoning behind it as well.

Upvotes: 0

Views: 324

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006614

assets/ is flexible in terms of structure. You can have your own directory tree in there, for organizing lots of files.

res/raw/ is flexible in terms of resource sets. You can have different versions of that resource for different configurations (e.g., res/raw/ as the default, res/raw-zh/ for use on devices configured for Chinese language use).

If you do not need any of those features, assets/ and res/raw/ are about equal in terms of capability. I tend to default to assets/.

Upvotes: 2

Related Questions