public class Utils {
public static List<Message> getMessages() {
//File file = new File("file:///android_asset/helloworld.txt");
AssetManager assetManager = getAssets();
InputStream ims = assetManager.open("helloworld.txt");
}
}
我使用这个代码试图从资产读取文件。我尝试了两种方法。首先,当使用 File时我接收到 FileNotFoundException,当使用 AssetManager getAssets()方法时不能识别。
有什么解决办法吗?