Service Module question

rfresh

Well-Known Member
Licensed User
Longtime User
I have a service module running, can I update the Main screen from that service module? I need to update a label and the main screen is displayed.

The service module is changing the state of an item and I'd like to update the label on the Main screen.

How can I do this?

Thanks...
 

rfresh

Well-Known Member
Licensed User
Longtime User
Ahhhh I see...and how would I check to make sure that Main is being displayed so I don't update it when another screen is showing?
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Hmmm...while that works, when my service module updates my Main activity screen Label.Text, it overwrites the label text on top of each other. I'm write the time into a label and what I see is the time over writing each time so it looks 'garbled'.

Do I need to refresh the Main activity or do something else?
 
Upvote 0

raphael75

Active Member
Licensed User
Longtime User
Ahhhh I see...and how would I check to make sure that Main is being displayed so I don't update it when another screen is showing?

You can use this code to call a Sub when Main activity is not paused:
B4X:
If IsPaused(Main) = False Then CallSub(Main, "NameOfSubInMainActivity")
 
Upvote 0

raphael75

Active Member
Licensed User
Longtime User
Hmmm...while that works, when my service module updates my Main activity screen Label.Text, it overwrites the label text on top of each other. I'm write the time into a label and what I see is the time over writing each time so it looks 'garbled'.

Do I need to refresh the Main activity or do something else?

It seems like your code creates/initializes a new label each time, instead of refreshing the existing label. Maybe you should show the code of your Sub in the forum, otherwise it's difficult to guess where the problem is.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Thanks for clarifying...I had my load layout in resume instead of in create...
 
Upvote 0
Top