Android Question Trying to terminate the program

seskindell

Active Member
Licensed User
Longtime User
Using this suggested routine:

Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("finishAffinity", Null)

It closes the window however my app is still running in the background.

Any suggestions?
 

Cableguy

Expert
Licensed User
Longtime User
Please read the "Activity life cycle" thread (in the forum) and the related chapter in @klaus booklets.

The OS itself will terminate (definitively) your app when he needs to (ie running in the background for too long and need to free resources for foreground apps).
 
Upvote 0

seskindell

Active Member
Licensed User
Longtime User
Since 21 .. this will do the job and take the program immediately out of the task bar:

Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("finishAndRemoveTask", Null)
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Should be very serious reasons to terminate the program.
Take a phone and try to find, at least, one pre-installed program, which terminates itself.

If you want to "hide" itself, use moveToBack, which works since API 1 (if I do not make a mistake).
 
Upvote 0
Top