Reading a simple text file

前端 未结 7 2021
甜味超标
甜味超标 2020-11-22 14:10

I am trying to read a simple text file in my sample Android Application. I am using the below written code for reading the simple text file.

InputStream inpu         


        
7条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-22 14:34

    Having a file in your assets folder requires you to use this piece of code in order to get files from the assets folder:

    yourContext.getAssets().open("test.txt");
    

    In this example, getAssets() returns an AssetManager instance and then you're free to use whatever method you want from the AssetManager API.

提交回复
热议问题