Android Question Problem with back button

I’m making a simple application (my first app) and I’m a beginner.

In my app, when I press back button, its exit from app.

Which code should I write to solve this problem and when I press back button, it loads my first layout.

also i used this code, but in doesnt work.
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
  If KeyCode = KeyCodes.KEYCODE_BACK Then
  Activity.LoadLayout("1")
  End If
  End Sub

Sorry for my bad English.
 
Top