How to kill my own Activity - the hard way

后端 未结 8 586
灰色年华
灰色年华 2021-01-31 10:59

So I have my Activity, and on pressing a \"Quit\" button I call Activity.finish(). This effectively closes my application.

The problem: The Dalvik-process of my applicat

8条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-31 11:27

    So I have my Activity, and on pressing a "Quit" button I call Activity.finish(). This effectively closes my application.

    Please don't do this.

    The Dalvik-process of my application is still hanging around as a zombie in background.

    The process is kept in a cache, for potential reuse by Android. You can safely ignore it.

    I have a remote service connected to my Activity, and this service won't unload until my Activity unloads (which as said it never does).

    You probably have a bug in your application, such as calling startService() and failing to call stopService(), or calling bindService() and failing to call unbindService().

提交回复
热议问题