read file from assets

前端 未结 18 2234
终归单人心
终归单人心 2020-11-21 22:47
public class Utils {
    public static List getMessages() {
        //File file = new File(\"file:///android_asset/helloworld.txt\");
        AssetMan         


        
18条回答
  •  独厮守ぢ
    2020-11-21 23:44

    If you use other any class other than Activity, you might want to do like,

    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader( YourApplication.getInstance().getAssets().open("text.txt"), "UTF-8"));
    

提交回复
热议问题