Can you upload an example that demonstrates the issue?
Sorry - I should have cut and pasted the code, but typed it in manually instead. It is working fine.The signature of KeyPress should be (see the warning messages in this sub):
B4X:Sub Activity_KeyPress (KeyCode As Int) As Boolean
Sub Activity_Create(FirstTime As Boolean)
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN Then
StartActivity(a1)
End If
End Sub