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

前端 未结 2 743
清歌不尽
清歌不尽 2020-12-21 14:06

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 els

相关标签:
2条回答
  • 2020-12-21 14:46

    A DataInputStream allows you to do a readLine (along with a host of other operations); see DataInputStream Reference.

    0 讨论(0)
  • 2020-12-21 15:01

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

    0 讨论(0)
提交回复
热议问题