Hello all and Erel in particular.
Sorry if the thread title is tricky, I just wanted to say my logic is inside a panel click event. It's not relayed to the panel clicking at all, it might happen anywhere else. Feel free to rename.
I am writing this to report for an uncaught exception by B4A which causes Force Close.
The code segment is:
I believe the error is somewhere between "maybe 1" and "maybe 3" because if they are commented out, it works. Also, this works perfectly if I use it in a "Picker" mode. However, this Activity is also being started not for a result and that's why I have to check whether the came_from object is Null because this controls whether to return the result or not.
My second question, what is the best way to check whether a certain object is NOT Null?
The keyword "Is" works but I didn't find "Is Not". It's not always useful to use "Is" and put the other code in "Else".
I almost forgot, the exception is:
Sorry if the thread title is tricky, I just wanted to say my logic is inside a panel click event. It's not relayed to the panel clicking at all, it might happen anywhere else. Feel free to rename.
I am writing this to report for an uncaught exception by B4A which causes Force Close.
The code segment is:
B4X:
Sub pnll_Click
Dim thePanel As Panel : thePanel = Sender
Dim theData As tProductCategory : theData = thePanel.Tag
zCommon.LogT("pnll_Click() theData = " & theData, "")
If(came_from <> Null) Then
selectorGetBack(theData) ' maybe here 1
came_from = Null ' maybe here 2
selectorBanList.Clear ' maybe here 3
Activity.Finish
End If
End Sub
I believe the error is somewhere between "maybe 1" and "maybe 3" because if they are commented out, it works. Also, this works perfectly if I use it in a "Picker" mode. However, this Activity is also being started not for a result and that's why I have to check whether the came_from object is Null because this controls whether to return the result or not.
My second question, what is the best way to check whether a certain object is NOT Null?
The keyword "Is" works but I didn't find "Is Not". It's not always useful to use "Is" and put the other code in "Else".
I almost forgot, the exception is:
java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Object
at anywheresoftware.b4a.keywords.Common$4.run(Common.java:884)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: java.lang.Object
at anywheresoftware.b4a.keywords.Common.getComponentBA(Common.java:909)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:899)
at anywheresoftware.b4a.keywords.Common$4.run(Common.java:833)
... 9 more
Last edited: