Android Question Clear back history

ambg

Member
Licensed User
Longtime User
is there any way to completely clean the history open activities and the back key to close the application?

For example

3 Activities (Main, 1,2)

Start Main Activity

In Main
StartActivity(1)

In 1
StartActvity(2)

In 2
Activity.Finish
StartActivity(Main)

If the user then click back key go back to 1 and i want that close the application.
 

ambg

Member
Licensed User
Longtime User
If you are targeting Android 4.1 (API level 16) then you can use this code to close all activities:
B4X:
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("finishAffinity", Null)

Works fine. Thanks
 
Upvote 0
Top