Android Question Can I Reference to the name of the current Sub?

GuyBooth

Active Member
Licensed User
Longtime User
Here is an example of code I often use at the start of a subroutine for tracking program progress in debug mode:

B4X:
Sub SetupPanel(pnlParent As Panel, lblFirstLetter As Label)
    Dim sCodeName As String
    sCodeName = "SetupPanel"
    Log("Sub " & sCodeName)
   
    Dim lItemHeight As Long
 
    etc

As you can see, I have to tailor it for each sub with the sCodeName = <name of sub> line.
Is there a way to use identical code in each sub, using something like "sCodeName = getsubname"?
I've been looking for a way to do this ever since I started using it in VB years ago.
 

Theera

Well-Known Member
Licensed User
Longtime User
You could CallSub Cammand,couldn't you?
 
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
You could CallSub Cammand,couldn't you?
I don't think this will do what I want - I simply want to be able to create a log entry that automatically includes the name of the sub. Perhaps I misunderstood what you meant?
 
Upvote 0
Top