安卓:编程方式打开"最近的应用程序和QUOT;对话 [英] Android: Programmatically open "Recent Apps" dialog

查看:128
本文介绍了安卓:编程方式打开"最近的应用程序和QUOT;对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够从我的应用程序中打开最近的应用程序对话框。这是由长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?

感谢您的帮助!

推荐答案

您无法访问。但是,它不是超级难推出自己的。该<一href="http://developer.android.com/reference/android/app/ActivityManager.html#getRecentTasks%28int,%20int%29"相对=nofollow> 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.

这篇关于安卓:编程方式打开&QUOT;最近的应用程序和QUOT;对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆