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

前端 未结 2 337
盖世英雄少女心
盖世英雄少女心 2021-01-07 23:33

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.

相关标签:
2条回答
  • 2021-01-07 23:48

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

    Previously discussed: Can the Android drawable directory contain subdirectories?

    0 讨论(0)
  • 2021-01-08 00:03

    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.

    0 讨论(0)
提交回复
热议问题