Android reading from .txt File created in src folder

前端 未结 2 701
眼角桃花
眼角桃花 2021-01-29 09:24

I am using this to get my File located in src folder src/file1.txt

InputStream is = openFileInput(\"file1.txt\");

and using BufferedReader to R

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-29 10:06

    Your src folder doesn't and won't exist on your emulator or device; it only exists on your host machine. If you want to read in a file delivered with your app, put it in either your raw or assets folder.

提交回复
热议问题