Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add text file resources to R.java

Tags:

android

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?

like image 641
techayu Avatar asked Mar 20 '26 18:03

techayu


1 Answers

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);
like image 166
micha Avatar answered Mar 22 '26 09:03

micha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!