Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read a local (res/raw) file line by line?

I have a text file in my res/raw directory. I want to read the file line by line, but FileReader and BufferedReader fail, because of Android's security restriction. How else can I do it?

like image 701
WeNeigh Avatar asked Jan 22 '26 00:01

WeNeigh


1 Answers

getResources().openRawResource() returns an InputStream that should be usable for line-by-line reading.

like image 176
CommonsWare Avatar answered Jan 24 '26 14:01

CommonsWare



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!