I'm doing:
FileReader fin = new FileReader("file:///android_asset/myFile.txt");
in an Android project and many variations. At runtime I get a file not found exception. The file is present and correct in the assets folder, so my path must be wrong.
What is the absolute path I need here?
AssetFileDescriptor descriptor = getAssets().openFd("myfile.txt");
FileReader reader = new FileReader(descriptor.getFileDescriptor());
Try using the above with FileDescriptors. Seems to be the most foolproof way I've found to gather asset paths.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With