Android Question Detect which code activated a Sub

aaronk

Well-Known Member
Licensed User
Longtime User
Hello,

I have a sub which has some code in it and many other subs can call and trigger code in that sub.

Is there a way to log which sub called another sub?

For Example:
In a activity I have..

Main:
B4X:
Sub run_me
   ' some code here
End Sub

Sub Trigger_1
   run_me  ' trigger the run_me sub
End Sub

Sub Trigger_2
  run_me  ' trigger the run_me sub
End Sub

Is there a way to find out which sub called the run_me sub ? (Trigger_1 or Trigger_2)

I have many subs that trigger a sub and I need to work out which sub actually triggers the sub.
I understand I can just put Log("Sub x") at the start of the code to find out but there are many subs and it will take to long to put all the logs in the app just to find the one sub I am looking for. Hoping there is a easy way to find out before I begin writing log in front of all the code that triggers the sub and then having to remove them all afterwards.
 

DonManfred

Expert
Licensed User
Longtime User
you can give the subname as parameter to "run_me"
 
Upvote 0
Top