I have a html file. I would like to reference it with the constant R I tried the following code :
getResources().openRawResource(R.raw.3);
I created a folder raw in the directory res and I included the file3.html
EDIT
…but don’t work!!the word “R.raw.3” is underlined
EDIT
I have another question. I have an array with the names of files to be accessed. How can I access with a statement like that?
getResources().openRawResource(R.raw.xxx);
If you have a file named file3.html in your raw folder under res folder your R.java file will contain a raw class like:
So, you should use
R.raw.file3instead ofR.raw.3because 3 is not a valid resource name, if you rename your file to 3.html you will find a invalid VariableDeclaratorId error in your R.java file