18

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.

Jim
  • 22,354
  • 6
  • 52
  • 80

2 Answers2

15

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

Previously discussed: Can the Android drawable directory contain subdirectories?

Community
  • 1
  • 1
Kyle Ivey
  • 5,992
  • 1
  • 23
  • 35
1

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.

Community
  • 1
  • 1
Levite
  • 17,263
  • 8
  • 50
  • 50