I have developed a useful tool for debugging B4A / B4J / B4I projects (it is a sw for windows) which:
adds to each project selected a small module that contains a routine for logs (it can be turned off);
adds to each routine a few calls to the log:
the first one shows the name of the module that contains the routine and the routine name (when the routine will be executed, of course);
some other show the parameters values.
Before (Activity name: actTwo):
After (Activity name: actTwo):
(LogColor used in B4A projects)
(The purpose of using the MyLog routine instead of Log is that it can be simply disabled by setting a global variable in the modMyUtils module).
No more hand written code like this (also no more need of "#IF Debug" structure)
Version: 2.0
It is not free but it costs a few dollars.
Version: 2.1
Added a function just to get a list of all modules and routines. See this post.
adds to each project selected a small module that contains a routine for logs (it can be turned off);
adds to each routine a few calls to the log:
the first one shows the name of the module that contains the routine and the routine name (when the routine will be executed, of course);
some other show the parameters values.
Before (Activity name: actTwo):
After (Activity name: actTwo):
(LogColor used in B4A projects)
(The purpose of using the MyLog routine instead of Log is that it can be simply disabled by setting a global variable in the modMyUtils module).
No more hand written code like this (also no more need of "#IF Debug" structure)
B4X:
#If Debug
Log("Btn.Tag: " & Btn.Tag)
#End If
tmpString = tmpTag.Replace("OnLongClickSub","#")
#If Debug
Log("tmpString1: " & tmpString)
#End If
tmpString = tmpString.SubString(tmpString.IndexOf("#")+2)
tmpString = tmpString.SubString2(0,tmpString.IndexOf(","))
#If Debug
Log("tmpString2: " & tmpString)
Log("End of tmpString: " & Asc(tmpString.CharAt(tmpString.Length-1))) 'Here there is a chr10 (LF) at end
#End If
tmpString = tmpString.Replace("_LongClick","")
#If Debug
Log("tmpString2: " & tmpString)
Log("End of tmpString: " & Asc(tmpString.CharAt(tmpString.Length-1))) 'Here the same chr10 at end also, any test you do with the variable tmpString after don't work.
' See the log attached
' I don't know if it's due to SubString2 or Replace but with Android 4.x i haven't this problem before.
#End If
tmpString = tmpString.Trim ' <- ' I have add this and that's work now
#If Debug
Log("End of tmpString: " & Asc(tmpString.CharAt(tmpString.Length-1))) 'Here nothing more than the SubString who is needed.
Log("Sender: " & tmpString)
#End If
Version: 2.0
It is not free but it costs a few dollars.
Version: 2.1
Added a function just to get a list of all modules and routines. See this post.
Attachments
Last edited: