Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to organise the res folder in android?

Tags:

android

I have a lot of files in /res/raw. Is there some way to organise this folder? Simply arranging into directories makes them invisible to R.raw.

like image 419
Jim Avatar asked Apr 06 '11 18:04

Jim


2 Answers

Sub-directories are not allowed within the Android resource folders. It is certainly inconvenient.

Previously discussed: Can the Android drawable directory contain subdirectories?

like image 193
Kyle Ivey Avatar answered Sep 22 '22 09:09

Kyle Ivey


Assets

Especially if you don't need a reference in your R class, (and no internationalization) use the assets folder.

InputStream inStream = getAssets().open("subfolder/filename.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));

It is meant to be on the same level as your res/java folder: src/main/assets/

Since you asked for the raw folder, there is a good chance this is what you want to use anyways.

like image 43
Levite Avatar answered Sep 20 '22 09:09

Levite