Android Question Beta B4A3 V6 Class problem

Erel

B4X founder
Staff member
Licensed User
Longtime User
You will need to change GetParent implementation to:
B4X:
Private Sub GetParent1(v As View)
   Dim r As Reflector
   Dim Parent As View
   
   r.Target = v
   Parent = r.RunMethod("getParent")
   If Parent Is Panel Then
     cParent = Parent
   Else
     cParent = cActivity
   End If
End Sub

Private Sub GetParent(v As View)
   Dim r As Reflector
   Dim Parent As View
   
   r.Target = v
   
   Parent = r.RunMethod("getParent")
   If Parent Is Activity Then
     cActivity = Parent
   Else
     cActivity = cParent
   End If
End Sub

The ClassCastException is not immediately detected in rapid debug mode so the exception is not raised (and caught) in your code.
 
Upvote 0
Top