D davelew1s Active Member Licensed User Longtime User Oct 4, 2015 #1 Hi! I have a main activity a class and the wifi direct service, I am trying to call a sub in the class from the service. I've tried 'callsub' and 'callsubdelayed' but I just get an error. Is there a way to do this? Thanks Dave.
Hi! I have a main activity a class and the wifi direct service, I am trying to call a sub in the class from the service. I've tried 'callsub' and 'callsubdelayed' but I just get an error. Is there a way to do this? Thanks Dave.
R Roycefer Well-Known Member Licensed User Longtime User Oct 4, 2015 #2 Have you created an instance of your class? Is it within the scope of the service? If so, then just call the sub directly. Upvote 0
Have you created an instance of your class? Is it within the scope of the service? If so, then just call the sub directly.
D davelew1s Active Member Licensed User Longtime User Oct 4, 2015 #3 Hi Roycefer thanks for the reply. I have this in Globals 'Dim dave As daveSubs' (daveSubs being the class)this i think means it cannot be seen from other modules, if i put it in Process_Globals i get 'Cannot access activity object from sub Process_Globals' But i have another class which is 'Dim kvs As KeyValueStore' in Process_Globals and works ok. Not sure where to go now any idea's? Dave. Upvote 0
Hi Roycefer thanks for the reply. I have this in Globals 'Dim dave As daveSubs' (daveSubs being the class)this i think means it cannot be seen from other modules, if i put it in Process_Globals i get 'Cannot access activity object from sub Process_Globals' But i have another class which is 'Dim kvs As KeyValueStore' in Process_Globals and works ok. Not sure where to go now any idea's? Dave.
R Roycefer Well-Known Member Licensed User Longtime User Oct 4, 2015 #4 Try something like this: Code: 'in Main module Sub SomeSub dave.whateverSub End Sub And then to call it from a service: Code: 'in service module CallSubDelayed(Main, "SomeSub") This will run Main's SomeSub if the Main Activity is currently active. If not, it will start the Main Activity (provided the app is not in the background). If the app is in the background, it will schedule SomeSub to run the next time the app comes to the foreground. Upvote 0
Try something like this: Code: 'in Main module Sub SomeSub dave.whateverSub End Sub And then to call it from a service: Code: 'in service module CallSubDelayed(Main, "SomeSub") This will run Main's SomeSub if the Main Activity is currently active. If not, it will start the Main Activity (provided the app is not in the background). If the app is in the background, it will schedule SomeSub to run the next time the app comes to the foreground.
D davelew1s Active Member Licensed User Longtime User Oct 4, 2015 #5 OK that's what i have done as a workround. But I have found that if i comment out the kvs.keystore my class is ok it looks like something in my code but no idea what yet.I am going to get some sun for a couple of hours and have a think think. Thanks Dave. Upvote 0
OK that's what i have done as a workround. But I have found that if i comment out the kvs.keystore my class is ok it looks like something in my code but no idea what yet.I am going to get some sun for a couple of hours and have a think think. Thanks Dave.