Android Question app crash at breakpoint

yaniv hanya

Active Member
Licensed User
Hi
I have this sub
B4X:
Sub SetColor   
    Dim sp As Panel=Sender
    Dim str() As String = Regex.Split(" ",sp.Tag)   
    colorPnl.Color=Colors.RGB(str(0),str(1),str(2))
    colorStr=sp.Tag
End Sub
and it is running very good.
but when I put a breakpoint inside the sub
sp is not initialized, the app crushs
and i get this log
java.lang.RuntimeException: Object should first be initialized (Panel).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.ViewWrapper.getTag(ViewWrapper.java:261)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at b4a.example.setledcolor._setcolor(setledcolor.java:168)
at b4a.example.setledcolor._panel5_click(setledcolor.java:322)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:5675)
at android.view.View$PerformClick.run(View.java:22641)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Do you have any idea why
 

DonManfred

Expert
Licensed User
Longtime User
Sub SetColor
Dim sp As Panel=Sender
what should this line do? there is no sender in a normal sub, only in a button_click event for ex.
 
Upvote 0

yaniv hanya

Active Member
Licensed User
I have a few buttons that are supposed to change the color of a panel (the colorPnl)
And all their click events point to this function.
By identifying the sender I decide which to color to change the panel.
As mentioned above it works fine but when I try to debug the project and put a breakpoint then it falls.
 
Upvote 0
Top