小编use*_*772的帖子

如何从片段中的资产读取文本文件?

我应该如何从中读取文本文件assets

我在这里使用片段。看起来我不能使用任何东西,getAssets();因为然后我得到:Error:(88, 37) error: cannot find symbol method getAssets()目标是能够读/写几个字符串。

例如:

AssetManager assetManager = getAssets();
InputStream inputStream = null;
try {
    inputStream = assetManager.open("hello.txt");
}
catch (IOException e){
    Log.e("message: ",e.getMessage());
}
Run Code Online (Sandbox Code Playgroud)

我希望能够在一个地方读取值,然后在代码的另一个地方写入值。请帮忙,我很绝望,我在网上找到的任何东西都不起作用

android text assets file fragment

0
推荐指数
1
解决办法
9018
查看次数

标签 统计

android ×1

assets ×1

file ×1

fragment ×1

text ×1