Hey guys
I'm trying to develop a little slide show in android. I've implemented the timer with a timertask and as expected the "run"-method is called everytime after the delay. But, however, when the delaytime has passed, the run method is called twice, so that the slide show slides two pictures instead of one.
Can anyone help me to solve this problem? Heres some code for better understandig what i've done.
public void startTimer() {
if(timer == null) {
timer = new Timer();
}
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
timerHandler.post(new Runnable() {
@Override
public void run() {
Log.d("Hier herein", "Timer abgelaufen");
}
});
}
}, 7000, 7000);
}
The startTimer()-Method is only called once, so I really don't understand, why the function is called twice. Thanks in advance :D