Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
... start another activity based on your custom tracking
Return True 'Consume the Back key and don't allow Android to process it by iteself
End If
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
If MyOtherPanel.Visible = True then
MyOtherPanel.Visible = False
Return True 'Consume the Back key and don't allow Android to process it by iteself
End if
End If
'If it gets here, the app will exit as usual
End Sub
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
I am testing on 4.0.4
Try the manifest edit and see if that works - or do you need to target ICS rather than Gingerbread or earlier?
I did find prior to editing my manifest file, that if i tapped my Activity then used the back key it would more often than not return to the last Activity.
Strange - guess the tap gives the current Activity the focus so the back key works as desired.
Martin.