开发者

How to make a list of recent/running apps

When holding the home b开发者_如何学编程utton 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() sounds like a method that could help you at whatever you're trying to accomplish.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜