techayu
techayu

Reputation: 1763

Add text file resources to R.java

I have text files named hierarchy1.txt, hierarchy1.1.txt and heirarchy1.1.1.txt in my android project->res->raw folder. These files have json objects. I m trying to read from these files but these are not getting added in my R.file. How do I resolve this?

Upvotes: 3

Views: 4709

Answers (1)

micha
micha

Reputation: 49562

You should use underscores instead of dots in your filenames. If you rename your file to hierarchy1_1.txt you should be able to access it with:

context.getResources().openRawResource(R.raw.hierarchy1_1);

Upvotes: 3

Related Questions