I am trying to find a way to open resources whose name is determined only at runtime.
In particular, I want to have XML that references a bunch of other XML files in the apk application. For the purpose of explanation, let's say the main XML is main.xml and the other XML is file1.xml , file2.xml and fileX.xml . I want to read main.xml , main.xml , extract the XML name I want ( fileX.xml ), and then read fileX.xml . The problem that I am facing is that what I am extracting from the main.xml form is a string and I cannot find a way to change this to R.raw.nameOfTheFile .
Anyone have an idea?
I do not want:
- regroup everything into one huge XML file
- hardcode main.xml in the huge case of a switch that associates a number / line with a resource identifier
android
Jason Rogers Sep 06 '10 at 4:05 2010-09-06 04:05
source share