S Squiffy Active Member Licensed User Longtime User Nov 18, 2016 #1 Can I get the name of the class I'm currently in? So I could, for a trivial example, say : B4X: Log("You are inside class name " & ClassName)
Can I get the name of the class I'm currently in? So I could, for a trivial example, say : B4X: Log("You are inside class name " & ClassName)
M mindful Active Member Licensed User Nov 18, 2016 #2 You need to do something like this: B4X: Dim MeName as String = Me MeName = MeName.SubString("class ".Length) Hope this helps ... Upvote 0
You need to do something like this: B4X: Dim MeName as String = Me MeName = MeName.SubString("class ".Length) Hope this helps ...
S Squiffy Active Member Licensed User Longtime User Nov 18, 2016 #3 @mindful - doesn't work. It returns some variable and object info but nothing containing the class name. Wondering if there is some JO method call I can make. Researching, but any pointers gratefully received... Upvote 0
@mindful - doesn't work. It returns some variable and object info but nothing containing the class name. Wondering if there is some JO method call I can make. Researching, but any pointers gratefully received...
S Squiffy Active Member Licensed User Longtime User Nov 18, 2016 #4 Sussed it. B4X: Dim jo As JavaObject = Me Dim ClassName As String=jo.RunMethod("getClass",Null) Log("ClassName=" & ClassName) Prints out b4j.example.theclassname Just need to strip it out. Thanks to mindful for introducing me to Me Upvote 0
Sussed it. B4X: Dim jo As JavaObject = Me Dim ClassName As String=jo.RunMethod("getClass",Null) Log("ClassName=" & ClassName) Prints out b4j.example.theclassname Just need to strip it out. Thanks to mindful for introducing me to Me
S Squiffy Active Member Licensed User Longtime User Nov 18, 2016 #5 Just for completeness : B4X: Dim jo As JavaObject = Me Dim ClassName As String=jo.RunMethod("getClass",Null) ClassName=ClassName.SubString(ClassName.LastIndexOf(".")+1) Upvote 0
Just for completeness : B4X: Dim jo As JavaObject = Me Dim ClassName As String=jo.RunMethod("getClass",Null) ClassName=ClassName.SubString(ClassName.LastIndexOf(".")+1)
M mindful Active Member Licensed User Nov 18, 2016 #6 Yep you are right. The code that I posted works only on code modules ! Upvote 0
S Squiffy Active Member Licensed User Longtime User Nov 18, 2016 #7 'sok, I didn't know what Me did until you posted. Huge help! Upvote 0