A decision to externalize some of the resources inside an Android app has been made, and it concerns some res/values arrays. They are along the lines of:
<string-array name="idd0">
<item>"000"</item>
<item>"007"</item>
<item>"005"</item>
</string-array>
<!-- 222 countries -->
<array name="idd">
<item>"00"</item>
<item>"00"</item>
<item>@array/idd0</item>
</array>
etc
These xml files will be now fetched over the internet, so I am now trying to avoid reinventing the wheel and do the complex parsing on my own, but rather reuse the Resources class of the platform. I figured that an easy way to do this would be to save these xml files to the resource folder of the app and somehow dynamically obtain a resource Id to work with. Is this doable ? How else could I approach this ?
Thank you
No, resources are fixed at compile time and your resources folder of your app is a read only part of your APK. There might be a way to create a new resource object and populate it, but even if it were possible, it’d be complicated (probably have to mess with class loaders), slow (reflection) and more work than it’s worth. There are plenty of XML parsing libraries out there, including ones built into Android. I’d recommend you research those to get you started.