简体   繁体   中英

How to make a list of recent/running apps

When holding the home button on your phone a pop up comes up showing recent applications. Does anyone know how to do this same action through code? I need to be able to choose one in a listview.

You need to use getRunningTasks

From the docs:

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

getRunningAppProcesses()听起来像一个方法,可以帮助您完成任何尝试。

Look into getRecentTasks(int, int) also.
This should show the history, whether or not the app is still "running"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM