Ted pottel
Ted pottel

Reputation: 6983

trying to have a text file as part of my app, so my app can load it

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.

Upvotes: 0

Views: 25

Answers (1)

pedrotorres
pedrotorres

Reputation: 230

Put the file in /res/raw

Then you can access it through:

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

Upvotes: 2

Related Questions