How to always start from a startup activity on Android?

后端 未结 9 1344
走了就别回头了
走了就别回头了 2020-12-09 10:52

There are three different cases:

1) A user launches an app, navigates in it, pressed home and click on the app icon again to launch our app again.

2) A user

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 11:53

    1) define a public static normalPause = true variable in a Class.

    2) in onPause method of all of your activities set it false (I am worry. We might not be in a normal pause)

    2) in onCreate method of all of your activities set it true (Do not worry. We are in a normal pause)

    3) in onResume of all of your Activities:

    if(!Utilities.normalPause)
    {
        this.finish()
    }
    

    Enjoy!

提交回复
热议问题