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");
}
}
I am using this code trying to read a file from assets. I tried two ways to do this. First, when use File
I received FileNotFoundException
, when using AssetManager getAssets()
method isn't recognized.
Is there any solution here?
Using Kotlin, you can do the following to read a file from assets in Android: