Access resource files in Android

If you have a file in res/raw/textfile.txt from your Activity/Widget call:

getResources().openRawResource(...) returns an InputStream

The dots should actually be an integer found in R.raw… corresponding to your filename, possibly R.raw.textfile (it’s usually the name of the file without extension)

new BufferedInputStream(getResources().openRawResource(...)); then read the content of the file as a stream

Leave a Comment