安卓:编程方式打开"最近的应用程序和QUOT;对话应用程序、最近、方式、QUOT

2023-09-05 08:54:18 作者:终止放荡

我希望能够从我的应用程序中打开最近的应用程序对话框。这是由长pressing home键打开此对话框。我编程为Android 4.1或更早版本。我找到了一种方法通过实现自定义AccessibilityService并调用AccessibilityService.performGlobalAction(GLOBAL_ACTION_RECENTS)做到这一点,但这需要让无障碍的手机,这是不是很可取的。是否有任何其他的方法来从一个应用程序打开此对话框?

I would like to be able to open the "Recent Apps" dialog from my application. This is the dialog that is opened by long-pressing the home button. I am programming for Android 4.1 or earlier. I found a way to do it by implementing a custom AccessibilityService and calling AccessibilityService.performGlobalAction(GLOBAL_ACTION_RECENTS), but this requires enabling accessibility on the phone, which is not very desirable. Is there any other way to open this dialog from an app?

感谢您的帮助!

推荐答案

您无法访问。但是,它不是超级难推出自己的。该 getRecentTasks()方法返回的最近运行的应用程序列表。简单地采取列表,并添加自己的UI吧。

You cannot access that. However, it isn't super hard to roll your own. The getRecentTasks() method returns a list of recently run apps. Simply take the list and add your own UI to it.

一个优点来这是默认的,至少是在旧版本的Andr​​oid,只能说明你约8应用程序。如果你滚你自己可以显示你所想要的。

One advantage to this is that the default one, at least on older versions of Android, only shows you about 8 apps. If you roll your own can show as many as you want.