The app crashes when the key back button is pressed on a certain screen. Curiosly, it only crashes in real devices like a phone or a tablet, in the emulator works well.
I'm searching the reason and the problem is because of a table class view added in 'pantalla_referencia' sub.
If I delete these lines the keyback function works fine. The log windows doesn´t show any error. In others parts of the app I call this sub and executes fine without problems, only crashes in the 'return true' line from key back. If I make a breakpoint in the 'return true' line I see in the screen device that the table has been created.
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then
If (intNUM_PANTALLA = 1) Then
pantalla_principal
Return True
Else If (intNUM_PANTALLA = 2) Then
pantalla_referencia
Return True 'Here is where the app crashes
Else If (intNUM_PANTALLA = 3) Then
pantalla_principal
Return True
End If
End If
End Sub
I'm searching the reason and the problem is because of a table class view added in 'pantalla_referencia' sub.
B4X:
Sub pantalla_referencia
.
.
.
tbREFERENCIADB.Initialize(Me, "tbREFERENCIADB", 3)
tbREFERENCIADB.AddToActivity(pnlREFERENCIADB, 0, 0, pnlREFERENCIADB.Width, pnlREFERENCIADB.Height - 20%y)
tbREFERENCIADB.SetHeader(Array As String("Referencia", "Máquina", "Puesto trabajo"))
tbREFERENCIADB.SetColumnsWidths(Array As Int(35%x, 20%x, 35%x))
tbREFERENCIADB.FontSize = 16 * TextSizeRatio
.
.
.
end sub
If I delete these lines the keyback function works fine. The log windows doesn´t show any error. In others parts of the app I call this sub and executes fine without problems, only crashes in the 'return true' line from key back. If I make a breakpoint in the 'return true' line I see in the screen device that the table has been created.