Hi guys,
I have 2 codes,
Code A
Code B
Info is a class that was never initialize before Sub Activity_KeyPress called. Those codes should return the same result, right?
But, they were not.
Code A, raised an error, null pointer operation. But, code B, runs without errors.
Am I missing something here?
I have 2 codes,
Code A
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK then
If Info.IsShow then
Info.Close
Return True
End If
End If
Return False
End Sub
Code B
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK And Info.IsShow Then
Info.Close
Return True
End If
Return False
End Sub
Info is a class that was never initialize before Sub Activity_KeyPress called. Those codes should return the same result, right?
But, they were not.
Code A, raised an error, null pointer operation. But, code B, runs without errors.
Am I missing something here?