Return the current activity?

Mickster

Active Member
Licensed User
Longtime User
I was wondering if there's a way to return the currently running activity? I know you can use 'isPaused()' but I have a lot of activities and would rather avoid keeping this if statement up to date when I create new activities.

For context, I'm creating a notification system for my app. It will be a class and will create alert boxes of my own design on the activity. The problem is that I have a service module to deal with communications and this module needs to be able to create notifications on the running activity.
 

mc73

Well-Known Member
Licensed User
Longtime User
You will need to implement it. You can create a CurrentActivity (Object) variable in your service and then add the following code to each Activity:
B4X:
Sub Activity_Resume
 YourService.CurrentActivity = Me
 ...
Just as an addition, the check for isPaused should still be performed (just for CurrentActivity object) or use a callSubDelayed. At least so I think.
 
Upvote 0
Top