如何通过点击按钮,打开安装的应用程序的Andr​​oid抽屉 [英] How to open installed applications drawer android by button click

查看:134
本文介绍了如何通过点击按钮,打开安装的应用程序的Andr​​oid抽屉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么可以导航到应用程序页面我的手机上通过我的应用程序点击一个按钮?这可能吗?

how can I navigate to the applications page on my phone by a button click from my app? is it possible?

更新

推荐答案

新星发射器有一个快捷方式提供,它可以让你选择的任何活动。只需调用此快捷方式提供从你code和选择所需的活动,然后简单的记录返回的意图。

Nova Launcher has a shortcut provider which lets you choose any activity. Simply call this shortcut provider from you code and select the activity you want, and then simple record the returned Intent.

虽然这种意图不能通用于所有Android版本。这将有包名和组件名称(而不是一个操作字符串)。

Though this intent not be universal for all android versions. It will have package name and component name (and not an action string).

在一个测试项目使用此code的一个活动。请确保你已经安装新星发射器(你可以稍后将其卸载)

Use this code in an Activity in a test project. Make sure you have Nova launcher installed (you can uninstall it later on)

public void onTestButtonClicked(View v) {
  startActivityForResult(Intent.createChooser(new Intent(Intent.ACTION_CREATE_SHORTCUT), "Select Activities"), 10);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (requestCode == 10 && resultCode == RESULT_OK) {
    Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
    Log.e("Intent", intent.toUri(Intent.URI_INTENT_SCHEME));
  }
}

这篇关于如何通过点击按钮,打开安装的应用程序的Andr​​oid抽屉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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