Android Question LogCat in Phone Library - optional arguments

pfhrr

Member
Licensed User
Longtime User
How do I pass optional arguments, when using LogCat?
https://developer.android.com/studio/command-line/logcat
In particular Filtering log output

Sub Process_Globals
Dim logger As LogCat
Dim args(1) As String

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Phone_tester")
logger.LogCatStart(args,"MyLogCatName")


Sub MyLogCatName_LogCatData(Buffer() As Byte, Length As Int)
Dim data As String
data = BytesToString(Buffer,0,Length,"UTF-8")
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

Starting logcat from Activity_Create, without checking that FirstTime is True, is a mistake. Worth watching the life cycle video tutorial: https://www.b4x.com/etp.html

Example of a filter that keeps all B4A tagged messages and all fatal level messages:
B4X:
Dim args() As String = Regex.Split(",", "-v,raw,*:F,B4A:v")
 
Upvote 0
Top