I'm following the example below, trying to read a file txt
:
public void ler(String caminho) {
try {
AssetManager assetManager = getResources().getAssets();
InputStream inputStream = assetManager.open(caminho);
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String linha;
LinkedList<String> linhas = new LinkedList<String>();
while ((linha = bufferedReader.readLine()) != null) {
linhas.add(linha);
}
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
But any past path, it does not find my file teste.txt
and it displays error:
W/System.err: java.io.FileNotFoundException: /storage/emulated/0/Download/teste.txt
What I need is to read the file as the last path. If you have another solution, it is also valid.