Android Question Strange Behavior with crashing

Discussion in 'Android Questions' started by Scantech, Apr 6, 2019.

  1. Scantech

    Scantech Well-Known Member Licensed User

    Code:
    CallSub2(Main, "ProcessOBDData_SelfTestMessage", FilterType)
    Code:
    Sub ProcessOBDData_SelfTestMessage(FilterType As String)
        
    'Remove Self Test Message
        If FilterType = 602 Then                 'FORD SELF TEST MESSAGE
            If lstView(VP.CurrentPage).GetSize >= 2 Then lstView(VP.CurrentPage).RemoveAt(1)
        
    End If
    End Sub
    This had me pulling my hair. It crashes only with my large project. I test the code above with new project and will not duplicate the error. I can correct it by adding a return line below it or add logs. Weird stuff happening.
     
  2. AnandGupta

    AnandGupta Active Member Licensed User

    Maybe adding a sleep will fix it.

    Regards

    Anand
     
  3. Scantech

    Scantech Well-Known Member Licensed User

    At first i thought it was related to the service name (Communication) then i renamed it but still an error.

    I think we need a new version for this fix. It is probably related to the name of ProcessOBDData_SelfTestMessage depending where the location of the underscore is will cause it to crash. Try Process_OBDDataSelfTestMessage it crashes.

    Also unused variable in the sub will not be detected using Underscore and also using same variable name in the sub will cause errors.

    See attach
     

    Attached Files:

    • Bug.zip
      File size:
      9 KB
      Views:
      25
    Last edited: Apr 6, 2019
  4. XbNnX_507

    XbNnX_507 Active Member Licensed User

    You should try CallSubDelayed2
    Code:
    CallSubDelayed2(Main, "ProcessOBDData_SelfTestMessage", FilterType )
     
  5. Scantech

    Scantech Well-Known Member Licensed User

    Have you tested the attached file?
     
  6. XbNnX_507

    XbNnX_507 Active Member Licensed User

    is not a bug in your Testing Service you have:
    Code:
    Sub ProcessOBDData(FilterType As Int, Index As Int, DataReceived As String, WhatMode As String, OptByte As String, lData As List)
       
    CallSub2(Main, "ProcessOBDData_SelfTestMessage", FilterType)
    End Sub
    FilterType declare as Int

    In your Main Activity you have
    Code:
    ProcessOBDData_SelfTestMessage(FilterType As String)
    FilterType Declare as String

    That's why it crashes.
     
    Scantech likes this.
  7. Scantech

    Scantech Well-Known Member Licensed User

    Leave it the way it was and change ProcessOBDData_SelfTestMessage (remove underscore) to ProcessOBDDataSelfTestMessage and it will not crash. Try it

    Its not related to int.
     
    Last edited: Apr 6, 2019
  8. XbNnX_507

    XbNnX_507 Active Member Licensed User

    it does crashes here:
    Code:
    java.lang.IllegalArgumentException: method b4a.example.main._processobddataselftestmessage argument 1 has type java.lang.String, got java.lang.Integer
     
  9. Scantech

    Scantech Well-Known Member Licensed User

    Like i said something is weird. It does not crash with mine. LOL
     
  10. Scantech

    Scantech Well-Known Member Licensed User

    what version b4a are u using?
     
  11. Scantech

    Scantech Well-Known Member Licensed User

    Update: Crash is random. Weird.
     
  12. XbNnX_507

    XbNnX_507 Active Member Licensed User

    I'm using B4A 9.0
     
  13. Scantech

    Scantech Well-Known Member Licensed User

    You should clean the project and retry it
     
  14. Scantech

    Scantech Well-Known Member Licensed User

    After cleaning project and removed Underscore it does crash. Why is my error message different then XbNnX?
    Changing String to int fixes the problem
     
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