如何杀死自己的活动 - 硬盘的方式自己的、硬盘、方式

2023-09-12 22:11:20 作者:殘念℡

所以,我有我的活动,并在pressing一个退出按钮,我叫Activity.finish()。这有效地关闭我的应用程序。

问题:我的应用程序的Dalvik的进程仍徘徊在后台一个僵尸。看起来这是正常的,因为其他应用程序做同样的。连个招呼世界的例子在内存中挂起左右。

我可以忍受这一点,但unfortunatley这种行为让我的应用程序有疼痛感的发展。我有连接到我的活动远程服务,而这种服务将无法卸载,直到我的活动卸载(这是说,这不可能发生)。

一切都以某种方式维持生命没有充分的理由。

我如何的真正的从内存中删除我的活动?

我在寻找类似Activity.finish_and_kill_my_process_please()调用或类似的东西。

解决方案   

所以,我有我的活动,并在pressing   一个退出按钮,我打电话   Activity.finish()。这有效地   关闭我的应用程序。

Please不这样做。

  

我的应用程序的Dalvik的过程   仍徘徊在一个僵尸   背景。

的方法,保持在高速缓存中,对于由机器人潜在的重用。您可以放心地忽略它。

  

予有连接到远程服务   我的活动,而这种服务将不会   卸载,直到我的活动卸载   (这是说,这不可能发生)。

您可能有一个错误在你的应用程序,如调用 startService()并没有叫 stopService(),或致电 bindService()并没有叫 unbindService()

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 application is still hanging around as a zombie in background. It seems like this is normal as other applications do the same. Even The hello-world example hangs around in memory..

I could live with this, but unfortunatley this behaviour makes the development of my application a pain. 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).

Everything is somehow kept alive for no good reason.

How can I really remove my Activity from memory?

I'm looking for something like Activity.finish_and_kill_my_process_please() call or something similar.

解决方案

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().