Based on this stackoverflow question in the answer, this code is suggested
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();
}
Doubt is with more variables as the command for it to jump jumps and stores the value in the variable within while
.
and the main doubt which folder should be arquivo txt
on Android? , since only the file name is passed.