To read a . txt from android, you can use the following code:
try {
AssetManager assetManager = getResources().getAssets();
InputStream inputStream = assetManager.open("nome-do-arquivo.txt");
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String linha;
LinkedList<String> linhas = new LinkedList<String>();
while((linha = bufferedReader.readLine())!=null){
//aqui com o valor da linha vc pode testar o que quiser, por exemplo: linha.equals("123")
linhas.add(linha);
}
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
Alexandre, the night I will do the test and return here. .
– Matheus Arruda
Resolver Alexandre.
– Matheus Arruda
@Matheusarruda ok! Any questions, just let us know!
– Alexandre Strevenski
@Alexandrestrevenski in which folder the txt file should be?
– Vale
@ramaral know that the answer is not yours, but you could tell me which folder should get the txt file.
– Vale
@Rodolfo inside the 'Assets' folder'.
– Alexandre Strevenski