D devmobile Active Member Licensed User Aug 9, 2017 #1 Hey Please see below code Code: Copy ' 1: Sub Class_Globals 2: 3: End Sub 4: 5: Public Sub Initialize 6: 7: End Sub 8: 9: Sub JobDone(Job As HttpJob) 10: 11: if job.success then 12: log("success") 13: else 14: 'get current activity that use this class 15: 'call method with name "ShowError" 16: end if 17: 18: End Sub In line 14 and 15 i need detect current activity and call method in relate activity I dont want to use CallSub or CallSubDelay Only need call method with current activity Thanks
Hey Please see below code Code: Copy ' 1: Sub Class_Globals 2: 3: End Sub 4: 5: Public Sub Initialize 6: 7: End Sub 8: 9: Sub JobDone(Job As HttpJob) 10: 11: if job.success then 12: log("success") 13: else 14: 'get current activity that use this class 15: 'call method with name "ShowError" 16: end if 17: 18: End Sub In line 14 and 15 i need detect current activity and call method in relate activity I dont want to use CallSub or CallSubDelay Only need call method with current activity Thanks
Erel B4X founder Staff member Licensed User Longtime User Aug 9, 2017 #2 Code: Copy Sub Class_Globals Private mCallback As Object End Sub Public Sub Initialize(Callback As Object) mCallback = Callback End Sub Sub JobDone '... CallSubDelayed(mCallback, "JobDone_Error") End Sub Activity code: Code: Copy MyClassIntance.Initialize(Me) Upvote 0
Code: Copy Sub Class_Globals Private mCallback As Object End Sub Public Sub Initialize(Callback As Object) mCallback = Callback End Sub Sub JobDone '... CallSubDelayed(mCallback, "JobDone_Error") End Sub Activity code: Code: Copy MyClassIntance.Initialize(Me)
D devmobile Active Member Licensed User Aug 9, 2017 #3 Erel said: Code: Copy Sub Class_Globals Private mCallback As Object End Sub Public Sub Initialize(Callback As Object) mCallback = Callback End Sub Sub JobDone '... CallSubDelayed(mCallback, "JobDone_Error") End Sub Activity code: Code: Copy MyClassIntance.Initialize(Me) Click to expand... I knew it but i need to call method with last opened activity maybe? Upvote 0
Erel said: Code: Copy Sub Class_Globals Private mCallback As Object End Sub Public Sub Initialize(Callback As Object) mCallback = Callback End Sub Sub JobDone '... CallSubDelayed(mCallback, "JobDone_Error") End Sub Activity code: Code: Copy MyClassIntance.Initialize(Me) Click to expand... I knew it but i need to call method with last opened activity maybe?
Erel B4X founder Staff member Licensed User Longtime User Aug 9, 2017 #4 Where is this class initialized? Starter service? Upvote 0
D devmobile Active Member Licensed User Aug 9, 2017 #5 Erel said: Where is this class initialized? Starter service? Click to expand... Service or Activity and maybe in Starter Service Upvote 0
Erel said: Where is this class initialized? Starter service? Click to expand... Service or Activity and maybe in Starter Service
Erel B4X founder Staff member Licensed User Longtime User Aug 9, 2017 #6 Sounds strange. Create a single instance in the starter service. Set the current activity with this code: Code: Copy Sub Activity_Resume Starter.YourClassInstance.mCallback = Me End Sub Put this code in each of the activities. Upvote 0
Sounds strange. Create a single instance in the starter service. Set the current activity with this code: Code: Copy Sub Activity_Resume Starter.YourClassInstance.mCallback = Me End Sub Put this code in each of the activities.
D devmobile Active Member Licensed User Aug 9, 2017 #7 Erel said: Sounds strange. Create a single instance in the starter service. Set the current activity with this code: Code: Copy Sub Activity_Resume Starter.YourClassInstance.mCallback = Me End Sub Put this code in each of the activities. Click to expand... Best solution Thanks Upvote 0
Erel said: Sounds strange. Create a single instance in the starter service. Set the current activity with this code: Code: Copy Sub Activity_Resume Starter.YourClassInstance.mCallback = Me End Sub Put this code in each of the activities. Click to expand... Best solution Thanks