android - 如何在完成时从最近的应用程序列表中删除 Activity ?

标签 android android-intent

我正在从一项服务启动一项 Activity ,并希望它出现在最近的应用程序列表中。

但是,如果我退出应用程序(例如,按下调用 finish() 的 Activity UI 上的按钮),我希望该 Activity 从最近的应用程序列表中删除。

使用 android:excludeFromRecents="true" 从最近的应用程序列表中排除 Activity 不会给我所需的初始 Activity 行为,即出现在最近的应用程序列表中的 Activity 。

这可能吗?

最佳答案

使用

android:excludeFromRecents="true"

对于 list 文件中的 Activity

android:excludeFromRecents

Whether or not the task initiated by this activity should be excluded from the list of recently used applications ("recent apps"). That is, when this activity is the root activity of a new task, this attribute determines whether the task should not appear in the list of recent apps. Set "true" if the task should be excluded from the list; set "false" if it should be included. The default value is "false".

关于android - 如何在完成时从最近的应用程序列表中删除 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21875653/

相关文章:

android - 将上下文传递给语音搜索

java - 如何以编程方式动态创建所有 Android ui 组件的列表?例如 TextView 、 ImageView 等

android - Html.fromHtml() 删除回车符 "&#xD"、 "\n"

android - 一个 Activity 中的多个 fragment

android - Retrofit2:未找到 HTTP 404

android - 如何完成除主 Activity 之外的所有 Activity 并调用另一个 Activity

android - 从另一个 Activity 回来后如何保持 Activity 中的值(value)

java - 按后退箭头时会调用 onResume() 。请查看详情

java - Android:如何确定是否设置了动态壁纸

java - 通过 GET 方法从 android 应用程序到 servlet 接收多个 null 参数