I'm not sure if this is the correct way to go about but I will try and explain what I want to do.
I have an Activity
which creates a fragment
called TemporaryFragment
with a label. What I want to do is create and start a service with a Timer
in it and that Timer
then updates the time in that TextView
.
The way I am thinking of going is somehow, when the Service
is started, passing the TextView
from the Activity
to the Service
and then the Service
keeping a reference to it.
Another possible way is to make the Activity
become a listener of the Service
and then calling a method in the Service
to update the TextView
.
Any thoughts would be great and maybe some options.
Thanks in advance.
ADDITION I'm sorry, I should also specify that I need this timer to run in the background. So when the application is sent to the background, I need the timer to carry on and only stop when I tell it to.