Android Question Try-Catch are several levels possible here?

Discussion in 'Android Questions' started by Gunnar Daehling, May 28, 2019.

  1. Gunnar Daehling

    Gunnar Daehling Member Licensed User

    Hello,

    one of my apps has the following problem:

    Code:
    Try
                        
    Catch
       
    ' Another problem can occur in this segment
    End Try
    I could solve that with this construction:

    Code:
    Try
                        
    Catch
       
    Try
                            
       
    Catch    
                            
       
    End Try
    End Try
    I am not sure if this can be programmed. Or could that cause problems?

    Best regards,
    Gunnar
     
  2. mcqueccu

    mcqueccu Active Member Licensed User

    One advice I picked from this forum is Avoid Using Try Catch.

    In as much as sometimes you want to try catch some errors and move on, Its not advisable. It can cause unforseen problems in some devices
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Try / Catch blocks do not behave differently on different devices.

    You can nest multiple blocks. Your code is valid.
    The debugger might be more fragile with complex catch blocks. However such issues will not happen in release mode.
     
    jimmyF and Gunnar Daehling like this.
  4. Gunnar Daehling

    Gunnar Daehling Member Licensed User

    I'm really glad to hear that. A big thank you.:)

    Best regards,
    Gunnar
     
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