Android Question Try catch not working

Discussion in 'Android Questions' started by awoo060, Mar 3, 2015.

Similar threads

B4A Tutorial Receiving shared images from other apps
B4A Tutorial GPS tutorial
B4A Tutorial [B4X] Tip - Modified server response
B4A Tutorial Uncaught Exceptions
B4A Tutorial SQL tutorial
  1. awoo060

    awoo060 Member 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.

    Cheers,
    Anthony.
     

    Attached Files:

  2. keirS

    keirS Well-Known Member Licensed User

    Try using SubExists instead:
    Code:
    If SubExists(t,"NonExistantMethod"Then
            result = 
    CallSub2(t, "NonExistantMethod""TestValue")
        
    End If
     
  3. awoo060

    awoo060 Member Licensed User

    Thank you keirS, you are awwwwwweeeeesome!!!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice