0

In my project, I declare the timer in Process_Globals. I Initialize the Timer in the Activity_Create inside If FirstTime.

I am not sure if I like to Initialize it in FirstTime due to issues I am experiencing. I do not know why! When my app is loaded and already completed the Activity_Resume, I then switch Orientation and then I call my Timer to enable it self. The Timer never gets raised.

Do you see any problem Initializing outside the FirstTime, because I do not have any problem doing that. It works every time. This is weird!

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Scantech
  • 9
  • 4

2 Answers2

0

It is better to only initialize the timer when FirstTime is True. As you declared it a process global object, it will be kept alive as long as the process runs.

Erel
  • 1,802
  • 2
  • 15
  • 58
  • I did initialize it First Time but the timer is not kept alive when orientation is switched. After Orientation is switch, I call my Timer.enable = true and it never gets raised. This problem only happens with my Project Car Gauge Lite. Other Project Samples works fine. – Scantech Nov 03 '11 at 16:07
  • Here is what I know so far. My Above statement stands true. However, when I add Timer.enable = False in the Activity_Pause then the timer gets raised on the Orientation switch. I fail to understand why? I never Enabled the timer in the first orientation. The other method, Initializing Timer without using FirstTime works flawlessly. I do not have to call Timer.enable = False in the Activity_Pause. It will be raised when ever you call it. – Scantech Nov 03 '11 at 16:32
  • Never mind. It is working correctly right now. I need a break! – Scantech Nov 03 '11 at 17:31
0

As has been said, the best way to declare it is in FirsTime, you have to take care when phone goes to idle, because timer will stop unless you prevent phone goes this mode.

Manu
  • 1,130
  • 3
  • 10
  • 26