Android Question Unfortunately, My Application has stopped

Frank Cazabon

Member
Licensed User
Longtime User
Hi,

I have a B4a application where I have an edit box which is used for inputting a number (either manually or using a bar code scanner).

If I manually enter an incorrect number (ie it is not found in my database) my messagebox stating this was an incorrect number is displayed, I click on OK and everything is fine.

If I scan it, the message gets displayed, but when I click on OK, I get another message "Unfortunately, My Application has stopped".

Nothing shows in the log as an error.

This is my code:

B4X:
Sub edtAWBLoadScan_TextChanged (Old As String, New As String)
    If New.Length = 12 Then
        Dim awb As String
        awb = New.SubString2(0,11)
     
        ' pull the rest of the data from table
        Dim m As Map
        m = DBUtils.ExecuteMap(SQLLite, "SELECT rnd_pk, rnd_rnhfk, rnd_awbfk, awb_number, awb_pieces, cus_number,cus_company FROM RunSheetDetails WHERE awb_number = ?", Array As String(awb))

        If m = Null OR m.IsInitialized = False Then
            Msgbox("You have scanned/entered an Incorrect AWB#","Incorrect AWB#")
        Else
             'other code
        End If

    End If

End Sub

Any ideas how to track this down?
 

DonManfred

Expert
Licensed User
Longtime User
Try to replace the msgbox with a log-command to see whether the msgbox is the problem (blocking the mainthread)
 
Upvote 0

Frank Cazabon

Member
Licensed User
Longtime User
Perhaps the error is in your 'other code' section...

Thanks, the other code never gets run because it is in the Else part of the loop.

I am trying to play a Beep rather than display the message and so far that seems to work, but I need to do a lot more testing.
 
Upvote 0
Top