Android Question b4xpages close the app

Addo

Well-Known Member
Licensed User
Longtime User
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?
 

TILogistic

Expert
Licensed User
Longtime User
see:


The question is:

How do I remove a page class?
 
Upvote 0

Unobtainius

Active Member
Licensed User
Longtime User
How then, without using ExitApplication, do you remove the application from the users view to at least give the user the impression it has closed?
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
How then, without using ExitApplication, do you remove the application from the users view to at least give the user the impression it has closed?

or Activity.finish it is recommended

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.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
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
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…