Back button behaviour

FMFREAK

Member
Licensed User
Longtime User
I have an Activity where, within that activity I have 2 menu buttons. Help and Over. When I click on one of them I start a new Activity

B4X:
Sub Help_Click
   StartActivity("help")
End Sub
Sub Over_Click
   StartActivity("over")
End Sub

The activity Help has the following code:

B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime1 As Boolean)
   Activity.LoadLayout("help")
   Activity.AddMenuItem("Help", "Help")
   Activity.AddMenuItem("Over de app", "Over")
End Sub

Sub Activity_Resume
   
End Sub

Sub Activity_Pause (UserClosed As Boolean)
   'Activity.LoadLayout("Main")
End Sub
Sub Help_Click
   StartActivity("help")
End Sub
Sub Over_Click
   StartActivity("over")
End Sub

And the Over activity has:

B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim Info As Label
End Sub

Sub Activity_Create(FirstTime2 As Boolean)
   Activity.LoadLayout("over")
   Info.Text="Over de app" & CRLF & CRLF & "Deze app is gemaakt door het Lorentz Casimir Lyceum." & CRLF & "Het is getest met de HTC Desire Z en op de AVD software van Google." & CRLF  &CRLF & "Het Lorentz Casimir Lyceum is niet aansprakelijk voor schade die is of dreigt te worden toegebracht en voortvloeit uit of in enig opzicht verband houdt met het gebruik van deze app." & CRLF & "Ook kunnen wij de correcte werking niet garanderen." & CRLF & "De Lorentz Casimir app maakt gebruik van internet, houd er dus rekening mee dat dit, afhankelijk van je internet abonnement, geld kan kosten" 
   Activity.AddMenuItem("Help", "Help")
   Activity.AddMenuItem("Over de app", "Over")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
   'Activity.LoadLayout("Main")
End Sub

Sub Help_Click
   StartActivity("help")
End Sub
Sub Over_Click
   StartActivity("over")
End Sub

When I click on the main activity on the Help button I get the right Activity but when I klik on the back button, the whole program had closed.
Did someone know a solution ?
 

FMFREAK

Member
Licensed User
Longtime User
No I don't see anything else. This is what the log says:


It looks like when I click on the Help button it closed the main activity, but I don't have any code to do that as you can see.
 
Last edited:
Upvote 0

FMFREAK

Member
Licensed User
Longtime User
I feel very stupid :BangHead::BangHead::BangHead:
Sometimes it helps when someone else looks to your code
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…