2011-04-27 40 views
1

我需要一点帮助,获取关于最后的信息,让我们说5应用程序已打开/使用。Android开发:查找/获取最近使用的应用程序

ActivityManager m = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE); 

     RecentTaskInfo task = m.getRecentTasks(5,0).get(0); 

然后我用:

String output = "the last application you've executed is '"+task.id+"' and the PID is '"+task.toString()+"'"; 

但它没有工作搞好。我想用ActivityManager跟踪最新的应用程序。

谢谢!

我们只需要获得足够的信息,以便我可以运行它们。

//西蒙

+0

你运行任何应用程序运行应用程序之前?重新启动Android设备/模拟器后,没有任何内容会显示出来。 – Haphazard 2011-04-27 13:32:47

+0

@ user727278:“但它效果不好” - 这是无用的描述。请详细解释发生了什么事。 – CommonsWare 2011-04-27 13:42:15

+0

嗯,我只是得到了一些奇怪的文字,对我没有任何意义。 – AndroidXTr3meN 2011-04-27 13:52:37

回答

相关问题