如何列出最近/正在运行的应用程序
按住手机上的主屏幕按钮会弹出一个弹出窗口,显示最近的应用程序。 有谁知道如何通过代码执行相同的操作? 我需要能够在列表视图中选择一个。
您需要使用getRunningTasks
来自文档:
public List
Return a list of the tasks that are currently running, with the most recent being first and older ones after in order
getRunningAppProcesses()听起来像一个方法,可以帮助您完成任何尝试。
查看getRecentTasks(int,int) 。
这应该显示历史记录,无论应用程序是否仍在“运行”