Android Question Back button only for change panels

VittorioBarile

Member
Licensed User
Hello everybody,
i have a question about back button: i would realize a back button to get back to last Panel i opened

Button for change panel:
Sub btn_Click
    Pnl1.Visible = False
    Pnl2.Visible = True
End Sub

How could i get back from Panel 2 to first panel? I could have a lot of panels to go on Panel 2.

Thanks for help ^^
 

JohnC

Expert
Licensed User
Longtime User
Just add this code to the Activity that you want to intercept the back key with:
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean

    Log("Keypress: " & KeyCode)
   
    Select Case KeyCode
        Case KeyCodes.KEYCODE_BACK

            '....handle the back key event yourself here ...      
           
            Return True    'returning true tells the OS that you handled the keypress event and that the OS should not do anthing further
    End Select
End Sub
 
Last edited:
Upvote 0
Top