Close application and launch home screen on Android

后端 未结 21 2031
我在风中等你
我在风中等你 2020-11-22 07:33

I have two different activities. The first launches the second one. In the second activity, I call System.exit(0) in order to force the application to close, bu

21条回答
  •  醉梦人生
    2020-11-22 08:27

    You can also specify noHistory = "true" in the tag for first activity or finish the first activity as soon as you start the second one(as David said).

    AFAIK, "force close" kills the process which hosts the JVM in which your application runs and System.exit() terminates the JVM running your application instance. Both are form of abrupt terminations and not advisable for normal application flow.

    Just as catching exceptions to cover logic flows that a program might undertake, is not advisable.

提交回复
热议问题