search

Home  >  Q&A  >  body text

How to launch app on android?

I want to click a button in an android application to kill all services and activities and launch the entire application. I tried the following two codes. After execution, it can be launched, but some mobile phones prompt that it is abnormal. The "App has stopped running" prompt is launched.

android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);

How to write?

巴扎黑巴扎黑2827 days ago720

reply all(3)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-16 13:27:58

    Just manage the Activity stack well
    There is no need to use this forced exit method android.os.Process.killProcess(android.os.Process.myPid());
    System.exit(0);

    reply
    0
  • 阿神

    阿神2017-05-16 13:27:58

    How to terminate the background service correctly

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 13:27:58

    You can refer to how to exit the service, and call stopService where needed

    reply
    0
  • Cancelreply