0

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.

Ted pottel
  • 6,869
  • 21
  • 75
  • 134

1 Answers1

2

Put the file in /res/raw

Then you can access it through:

getResources().openRawResource(R.raw.filename);

pedrotorres
  • 230
  • 1
  • 10