Android:禁用最近的应用程序意图

发布于 2024-09-06 04:36:36 字数 359 浏览 3 评论 0原文

我想禁用当您按住主页按钮时从图标触发的最近的应用程序意图。我当前正在 onCreate() 中检测是否从快速启动对话框触发意图,然后调用 finish()

这意味着当应用程序进入后台时,finish() 会被调用,以便当应用程序启动时,它会执行 onCreate()。这需要在应用程序中的活动之间切换时进行策略性编码。

我想我也可以在检测到意图来自何处后在 onResume() 中触发 finish() ,但是如果快速启动意图,则可以消除一堆不必要的编码可以简单地禁用。

可以禁用快速启动意图吗?

I want to disable the recent apps intent that is fired from the icon when you hold the home button. I am currently detecting, in the onCreate(), if the intent is fired from the quick launch dialog, and then I call finish().

This entails that when the application goes to the background finish() is called so that when the app is launched it goes through the onCreate(). This requires strategic coding when switching between activities in the application.

I guess I can fire finish() in the onResume() also after detecting where the intent came from, but a bunch of unnecessary coding can be eliminated if the quick launch intent can simply be disabled.

Can the quick launch intent be disabled?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

好倦 2024-09-13 04:36:36

快速启动意图可以是
已禁用?

android:excludeFromRecents="true" 在此活动的清单中。这将导致您的活动不会出现在最近使用的活动列表中,这就是我假设您所说的“快速启动”。

Can the quick launch intent be
disabled?

Put android:excludeFromRecents="true" in the manifest for this activity. That will cause your activity not to appear in the list of recently used activities, which is what I am assuming you are calling the "quick launch".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文