Android Question How to call timer_tick from a different activity

Kwame Twum

Active Member
Licensed User
Longtime User
Hi everyone, I've got three activities in my project say: (Main, Act1 and Act2)
I've declared a timer in Main (Process_Globals).
I've created a sub timer_tick event in Act.
I also initialized and enabled the timer in Act1 at Activity_Create
However, my tic event doesn't fire... when Act1 is started.

Am I doing anything wrong? Need help.
 

LucaMs

Expert
Licensed User
Longtime User
Hi everyone, I've got three activities in my project say: (Main, Act1 and Act2)
I've declared a timer in Main (Process_Globals).
I've created a sub timer_tick event in Act.
I also initialized and enabled the timer in Act1 at Activity_Create
However, my tic event doesn't fire... when Act1 is started.

Am I doing anything wrong? Need help.

You should declare the timer in the Act1 Process_Globals!
 
Upvote 0

Kwame Twum

Active Member
Licensed User
Longtime User
Which activity contains the Tick code?
The Tick will only fire on the activity that is visible.

The tick code is in Act1, because that will be the visible activity
The declaration however is in the activity Main.

You should declare the timer in the Act1 Process_Globals!
I tried that... it only gave errors. I later learnt from the forums I have to declare it in the Main Activity.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
If Act1 is the visible Activity then you should declare the timer AND the TICK-Sub in Act1.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
This is similar to my #3 (Yesterday at 1:43 PM) :)
No,its not.

You said:
You should declare the timer in the Act1 Process_Globals!

I said:
Where is the timer initialized? It MUST be initialized in Act1.

It doesnt matter where you declare the timer as long as it is in process globals (it can be accessed by any module).
It does matter where you initialize it, because it uses that activity/service context to create the event within the same module.
 
Upvote 0

Kwame Twum

Active Member
Licensed User
Longtime User
It doesnt matter where you declare the timer as long as it is in process globals (it can be accessed by any module).
It does matter where you initialize it, because it uses that activity/service context to create the event within the same module.
Thanks Soul and everyone, I initialised the timer in activity Main right after declaring it. I moved it to Act1. It works now.
Many thanks!
 
Upvote 0
Top