S sweddle Member Licensed User Longtime User Mar 18, 2015 #1 Hello, I have B4A app that has a button that when clicked starts a service and in the same app I have a label named lblSTAT. I would like for the service I made in B4A and started via the app to be able to update the text of the app. But I'm not sure how to do that or make the call from the service to update the label.. I tried lblSTAT.Text = "Hello world" but no luck Thanks for any help! Shane
Hello, I have B4A app that has a button that when clicked starts a service and in the same app I have a label named lblSTAT. I would like for the service I made in B4A and started via the app to be able to update the text of the app. But I'm not sure how to do that or make the call from the service to update the label.. I tried lblSTAT.Text = "Hello world" but no luck Thanks for any help! Shane
Erel B4X founder Staff member Licensed User Longtime User Mar 18, 2015 #2 See this tutorial: Using CallSubDelayed to interact between activities and services Upvote 0
T Troberg Well-Known Member Licensed User Longtime User Mar 18, 2015 #3 It's always a good practice to not set internal stuff in one component from another component directly. Instead, add a sub to the activity, such as: Code: Copy Sub SetStat(text as string) lblSTAT.Text = "Hello world" End Sub Then, use CallSubDelayed as Erel suggested to call that sub. That way, you'll get all the external connections properly documented, which is a godsend when you start changing stuff a month later... Upvote 0
It's always a good practice to not set internal stuff in one component from another component directly. Instead, add a sub to the activity, such as: Code: Copy Sub SetStat(text as string) lblSTAT.Text = "Hello world" End Sub Then, use CallSubDelayed as Erel suggested to call that sub. That way, you'll get all the external connections properly documented, which is a godsend when you start changing stuff a month later...