Sub Log_StackTrace
Dim lines As List
#if B4A or B4J
Dim jo As JavaObject
lines.Initialize
Dim stack() As Object = jo.InitializeStatic("java.lang.Thread").RunMethodJO("currentThread", Null).RunMethod("getStackTrace", Null)
For Each st As JavaObject In stack
lines.Add(st.RunMethod("getClassName", Null) & ": " & st.RunMethod("getMethodName", Null))
Next
#else if B4i
Dim no As NativeObject
Dim stack As List = no.Initialize("NSThread").RunMethod("callStackSymbols", Null)
lines = stack
#end if
Log("****************")
Dim found As Boolean
For Each line As String In lines
If found Then
Log(line)
Else If line.Contains("log_stacktrace") Then
found = True
End If
Next
End Sub