I'm developing a simple app with Android Studio and I need to create a timer to run some methods every 1 second.
I tried the following but it did not work:
int delay = 1000;
int interval = 1000;
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
// métodos ...
}
}, delay, interval);
When the timer is activated for the first time, a fatal error will occur closing the application.