I am using android studio to build my app. I have a text file called testdata.txt. I would like this file to be loaded in with my app. Then have my app read the file. I figured out how to open and read files, but I dont know how to add the file to my project so it will be loaded when the app is loaded.
Asked
Active
Viewed 23 times
0
-
dup of http://stackoverflow.com/questions/5771366/reading-a-simple-text-file – Pavel Dudka Aug 10 '15 at 20:45
1 Answers
2
Put the file in /res/raw
Then you can access it through:
getResources().openRawResource(R.raw.filename);

pedrotorres
- 230
- 1
- 10