Start the method when starting the program, what I need is for the loop to run and then generate a timeout (1 minute) and rerun the task past the timeout (but also run the loop. . and so on) As I have it now, when you enter the method, it launches the waiting time.
public void comprobarFallos() {
timerTask = new TimerTask() {
@Override
public void run() {
for (int i = 0; i < listaFallos.size(); i++) {
if (listaFallos.get(i).equals("1")) {
playAudios.playAudio(listaAudios.get(i));
}
}
}
};
// Aquí se pone en marcha el timer CADA 2 MINUTOs
timer.scheduleAtFixedRate(timerTask, 0, TIEMPOESPERA);}