Android: getAssets().openFd() and FileNotFoundException

How about this:

InputStream in = context.getAssets().open("openAccess.txt");
reader = new InputStreamReader(in);

try this :

AssetFileDescriptor descriptor = getAssets().openFd("openAccess.txt");
BufferedReader f = new BufferedReader(new FileReader(descriptor.getFileDescriptor()));
String line = f.readLine();
while (line != null) {
    // do stuff
    Log.d("TAG",line);
}

Leave a Comment