Reputation: 1043
The Android Project Resource directories are located at,
app/src/main/res/drawable
app/src/main/res/layout
app/src/main/res/values
...
Suppose I would like to add a source file as,
app/src/main/res/myRes/res001.xml
Is it possible to read the resource info from my code? or my resource files are strictly restricted to the supported resource directories?
Upvotes: 0
Views: 1147
Reputation: 739
Custom resources are not supported by Android. You must use any of the predefined structure folders of Android. If you still would like to add custom resources use /res/xml
for xml resources and /res/assets for all other resources like fonts, text files etc.
Upvotes: 1
Reputation: 3533
You'll have to decide on a type.
Androids resource system have specific directories for specific resource types. You can't just 'add a resource', you have to decide on the type, for example:
That being said you can make gradle do anything, like for example include several resource directories, like main/res and release/res
Upvotes: 1
Reputation: 1007484
Suppose I would like to add a source file as
app/src/main/res/myRes/res001.xml
You should get a compile error, as you cannot invent new resource types. Either put that file in res/xml/
(which can handle any sort of XML), res/raw/
(which can handle any sort of file), or assets/
.
Upvotes: 2