InputStream can not find file

2

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.

    
asked by anonymous 25.04.2018 / 15:22

0 answers