把手强制关闭? [英] Handle force close?

查看:187
本文介绍了把手强制关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法,通知强制关闭请求的活动/服务的权利之前,它就会被杀死?

Is there a way to notify an activity/service of a force-close request right before it gets killed?

我的意思是,当用户点击的力量关闭按钮在菜单>设置>应用程序>管理应用程序>应用程序名称>强制关闭。

I mean when the user hits the force close button in Menu>Settings>Applications>Manage applications>app name>Force Close.

谢谢!

推荐答案

我的认为的的ActivityManager只是杀死宿主进程,所以你可能无法得到任何事件/消息/警告。要检查您可以创建一个应用程序,有一个单一的活动的,让你知道的的onDestroy 的被调用时,如果还的 isFinishing 的调用。

I think the ActivityManager just kills the hosting process, so you may not be able to get any event/message/warning. To check you could create an app that has a single Activity that lets you know if onDestroy is called, and further if isFinishing is invoked.

的路径菜单>设置>应用程序>管理应用程序>应用程序名称>强制关闭源代码中,如果有帮助,就是:

The path to "Menu>Settings>Applications>Manage applications>app name>Force Close" in the source, in case it helps, is:

ManageApplications: <一href="http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob_plain;f=src/com/android/settings/ManageApplications.java;hb=master" rel="nofollow">http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob_plain;f=src/com/android/settings/ManageApplications.java;hb=master

ManageApplications: http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob_plain;f=src/com/android/settings/ManageApplications.java;hb=master

InstalledAppDetails: <一href="http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob_plain;f=src/com/android/settings/InstalledAppDetails.java;hb=master" rel="nofollow">http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob_plain;f=src/com/android/settings/InstalledAppDetails.java;hb=master

InstalledAppDetails: http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob_plain;f=src/com/android/settings/InstalledAppDetails.java;hb=master

ActivityManager.forceStopPackage: <一href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/app/ActivityManager.java;hb=HEAD" rel="nofollow">http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/app/ActivityManager.java;hb=HEAD

ActivityManager.forceStopPackage: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/app/ActivityManager.java;hb=HEAD

ActivityManagerNative.forceStopPackage: <一href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/app/ActivityManagerNative.java;hb=HEAD" rel="nofollow">http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/app/ActivityManagerNative.java;hb=HEAD

ActivityManagerNative.forceStopPackage: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/app/ActivityManagerNative.java;hb=HEAD

一旦得到它把手拿开到服务,做脏活累活的母语水平。同样,我猜它只是停止的过程,但是这是一个猜测,我不知道把我的头顶部,其中原生界面的另一面是源检查(虽然它的存在的地方,如果你捅四周,想知道肯定)。

Once it gets the native level it hands off to a Service that does the dirty work. Again, I would guess it just stops the process, but that's a guess, and I don't know off the top of my head where the other side of the native interface is in the source to check (though it's there somewhere if you poke around and want to know for sure).

另外,你可能要添加的为什么的你想要这个信息,你的问题,有可能是一个不同的/更好的角度,以获得自己想要的成就,这取决于这一点。

Also you might want to add why you want this information to your question, there might be a different/better angle to getting what you want accomplished, depending on that.

这篇关于把手强制关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆