Android Question Try catch not working

awoo060

Member
Licensed User
Longtime 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.

Cheers,
Anthony.
 

Attachments

  • TryCatchProblem.zip
    6.5 KB · Views: 246

keirS

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