java - 如何列出最近/正在运行的应用程序

标签 java android

按住手机上的主页按钮时,会出现一个弹出窗口,显示最近的应用程序。有谁知道如何通过代码执行相同的操作?我需要能够在 ListView 中选择一个。

最佳答案

您需要使用 getRunningTasks

来自文档:

public List<ActivityManager.RunningTaskInfo> getRunningTasks (int maxNum)

Return a list of the tasks that are currently running, with the most recent being first and older ones after in order

关于java - 如何列出最近/正在运行的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6870487/

相关文章:

javascript - 如何使用 Spring MVC 和 ThymeLeaf 正确验证复选框?

android - 扩展 Android.util.Log 以写入文件

android - 地理位置的准确性

java - 将 pdf 转换为缩略图并将该数据也保存到 solr 中吗?

android - 使用 Parcelable 接口(interface)..?

javascript - Golang 和 HTML5/CSS/JavaScript(ANDROID 应用程序)

android - 解析html页面

java - 为什么当 application.properties 存在时不使用 @PropertySource ?

java - 是 <T> 列表<?扩展 T> f() 一个有用的签名

java - 如何扩展 Canvas 的Context2d?