Timer function adding an extra Timer on each call

Can anyone help me with my two Timer Functions:

The first one just makes the timer while canceling any previous one out first,

The second one just handles Cancelling the Timer

public void startInterval(int delay, int time, final String eventName){


mInterval = new Timer();

mInterval.scheduleAtFixedRate(new TimerTask() {


public void run() {

Log.i("timer", "Interval");

sendEvent(eventName, Arguments.createMap());


}, delay, time);


public void cancelInterval() {

if (mInterval != null){




mInterval = null;


The problem is that the timer is multiplying every time I call it.

The first time I call, it works as intended, but after a few calls it ends up adding an extra timer per...

Read More »

By: StackOverFlow - Monday, 16 April

Related Posts