Android Question Try catch not working

Similar threads

B4A Tutorial Receiving shared images from other apps
B4A Tutorial GPS tutorial
B4A Code Snippet Parsing your apps logs
B4A Tutorial Uncaught Exceptions
B4A Tutorial SQL tutorial


Licensed User
Hey everyone, searched the forums for the same title as this one, with no luck.

I'd like to suppress an error that I know will happen in some circumstances, so that the user doesn't get an ugly message; instead, it is ignored.

Attached is the code. Simply, I am trying to set up the equivalent of a callback function to a different class, if the function exists. I've put a try/catch around the callsub2 method, and run it in release mode but still get an ugly error message and can't suppress it.

Attached is a sample project.
The goal is to suppress the error message, not necessarily to get the try catch working, so I'm open to anyways to achieve this.




Well-Known Member
Licensed User
Try using SubExists instead:
If SubExists(t,"NonExistantMethod") Then
        result = CallSub2(t, "NonExistantMethod", "TestValue")
    End If