i have problems with timers in 2 different apps, and cant seem to work out what is going wrong-
App no.1
I create a view class and push it,
Within that view there is a variable 'maintimer' and in onShow() I do -
maintimer = new Timer.Timer();
maintimer.start(method(:onTimer), 1000, true);
to create a 1 second repeating timer. This works fine.
however when the view is popped the timer continues to run, I've tried calling maintimer.stop() before the view pops itself even tried maintimer.stop without the parenthesis, I've tried maintimer=null; and I've tried both together, but I can see in the debugger that the onTimer() function in the view is still being called every second even after its popped from the screen, I've tried assigning the view to null in the class which created it and yet it still exists and its onTimer function is still being called. When a new view is then created it causes some weird behaviour and crashes in the onTimer function.
In the second app it seems a similar thing is happening where a timer in a view is still extant after being stopped and the view popped as making a new instance of the view and push/popping it 3 times gives a "too many timers" error on the device itself, as if the timers aren't being disposed of despite being assigned null and the view class they were contained in being popped.
what do I need to get the timer to stop? and what do I need to do to get the variable freed up so I can use it with a new timer (or the view instance disposed of so I can create a new instance of it from scratch for that matter)?
thanks