Android Question Best Practices - closing an app?

tseyfarth

Member
Licensed User
Longtime User
Hello,

What are the best practices when closing an app from within an app?

Thank you,
Tim
 

Star-Dust

Expert
Licensed User
Longtime User
B4X:
Sub CloseActivities
   Dim jo As JavaObject
   jo.InitializeContext
   jo.RunMethod("finishAffinity", Null)
End Sub

Or
B4X:
Dim jo As JavaObject 
jo.InitializeContext 
jo.RunMethod("finishAndRemoveTask", Null)
 
Last edited:
Upvote 0

tseyfarth

Member
Licensed User
Longtime User
Thank you Star-Dust,

However I get an error during runtime -

Any idea how to fix this?

Tim

 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
This method only works on Android. You can't use it with B4J
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…