how to properly close the entire app of b4xpages ?
currently, I do something like this
B4X:
private Sub B4XPage_CloseRequest As ResumableSub
Dim sf As Object = xui.Msgbox2Async("Close?", "Title", "Yes", "Cancel", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
B4XPages.ClosePage(Me)
Return True
End If
Return False
End Sub
but this won't close the app instead it sends it to the background! what exactly needed to immediately close the b4xpages app?
how to properly close the entire app of b4xpages ?
currently, I do something like this
B4X:
private Sub B4XPage_CloseRequest As ResumableSub
Dim sf As Object = xui.Msgbox2Async("Close?", "Title", "Yes", "Cancel", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
B4XPages.ClosePage(Me)
Return True
End If
Return False
End Sub
but this won't close the app instead it sends it to the background! what exactly needed to immediately close the b4xpages app?
B4XPages makes many things simple and even trivial. As Android developers, we are dealing with these challenges for many years now so it might take us a while to understand how simple things can be. As explained in B4XPages tutorial, there are two purposes for B4XPages: Provide a cross...
www.b4x.com
The three most important things regarding the B4XPage classes are:
The page classes are 100% regular classes. They don't have a special life cycle and you can do whatever you like with them. There are some B4XPages events but they don't affect the state of the class itself. This is not the case with activity modules.
The page classes are never paused. Nothing special happens when a page is no longer visible or when the app moves to the background. Eventually of course, the whole process will be killed when the app is in the background.
The page classes are never destroyed separately. The class global variables and views state will never be reset (until the process is killed).
Whichever method you use, Android will leave the app in memory (but not running) for as long as it can. This is to be more efficient. When you come back to the app, if it's still in memory, Android can run it again right away; if it isn't still in memory, then Android has to spend time and energy loading the app from storage again.
In old Android versions, apps left in memory in the background this way were included in the list of "running apps". This is a little confusing for users - it makes people think the app is really still running - so newer versions call these apps "cached background processes", to make it clear they're only cached, not running.
Don't know if this can be of any help. It was a function I used in an old app of mine:
B4X:
Sub RemoveActivityFromForeground
'*** Below code moves the task containing this activity to the back of the activity stack.***
'*** It's a quick way to remove your activity, more or less like "bring to back"
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("moveTaskToBack", Array(True))
'********************************************************************************************
End Sub