Hi All
I'm tring to use the androids back button to move back to the B4XPages page that called the current page.
The app works fine sometimes and the back button closes the page and reviels to page above, BUT sometimes it minimises the the whole app, sometimes nothing.
I have just added this, but it is not triggered when the android phones main back button is clicked, not we have the title bar hidden so the b4xpages X is not in the screen.
If someone could indicate how to change the background colour of the activity title bar we could use that, but it needs to change depending on the user that is logged in.
Cheers in advance David
I'm tring to use the androids back button to move back to the B4XPages page that called the current page.
The app works fine sometimes and the back button closes the page and reviels to page above, BUT sometimes it minimises the the whole app, sometimes nothing.
I have just added this, but it is not triggered when the android phones main back button is clicked, not we have the title bar hidden so the b4xpages X is not in the screen.
If someone could indicate how to change the background colour of the activity title bar we could use that, but it needs to change depending on the user that is logged in.
Cheers in advance David
Example kindly taken from b4x.com:
Private Sub On_KeyPress(ViewTag As Object, KeyCode As Int, KeyEvent As Object) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
Dim j As JavaObject = KeyEvent
Dim eventCode As Int = j.RunMethod("getAction",Null)
Log("EventCode is:"&eventCode)
If (eventCode = 0) Then
' 0=ACTION_DOWN, 1=ACTION_UP, 2=ACTION_MULTIPLE
Main.MonitoringBackButtonPressed = True ' This is just to let the MonitoringListTypes page know that the user pressed then back button on its child page, our code does different things depending if you are coming down to the page or working you way back up towards to home page.
B4XPages.ShowPageAndRemovePreviousPages("MonitoringListTypes")
End If
Return True
Else
Return False
End If
End Sub