Android Question Error received in panel_click at GetParent

ThePuiu

Active Member
Licensed User
Longtime User
I have the following code:
B4X:
    Sub SetCantitateConsumata_Click
    Dim pnl As ImageView
    pnl = Sender
    Dim parentPanel As Panel = GetParent(pnl)
End Sub

Sub GetParent(v As View) As View
    Dim r As Reflector
    r.Target = v
    Return r.RunMethod("getParent")
End Sub

The code works well in Debug mode but gives the following error in Release at line GetParent(pnl):
java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1682)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4947)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at iso.soft99.lucrari$ResumableSub_SetCantitateConsumata_Click.resume(lucrari.java:1088)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1680)
... 9 more


Can you help me with an idea?
Thank you!
 
Top