如何添加条目(指向活动),以"主屏幕 - >菜单 - >添加 - >快捷键和QUOT ;? [英] How to add entry (pointing to Activity) to "Home Screen -> Menu -> Add-> Shortcuts"?

查看:123
本文介绍了如何添加条目(指向活动),以"主屏幕 - >菜单 - >添加 - >快捷键和QUOT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写为Android(SDK 1.5)程序。我想知道如何添加/注册我的计划活动之一,在主屏幕 - >菜单 - >添加 - >快捷键(或英雄主屏幕 - >菜单 - >添加到首页 - >快捷方式),所以该用户将能够将其添加到自己的主屏幕。是否有一个意图过滤器或任何其他方式来实现这一目标?

I'm writing program for Android (SDK 1.5). I would like to know how to add/register one of my program activities in "Home Screen -> Menu -> Add-> Shortcuts" (or on Hero "Home Screen -> Menu -> Add to Home-> Shortcut") so that user will be able to add it to his home screen. Is there an Intent Filter or any other way to achieve that?

感谢

推荐答案

这实际上是盖在<一个href=\"http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LauncherShortcuts.html\"相对=nofollow> API示例(应用程序/启动快捷键)。还检查了ApiDemos清单,它提供了pretty很好的解释(寻找LauncherShortcuts一部分)。

This is actually covered in the API Samples (App/"Launcher Shortcuts"). Also check out the ApiDemos manifest, which provides a pretty good explanation (look for the LauncherShortcuts part).

基本上,你在包含您的清单提供了一个意图过滤器

Basically, your provide an intent filter in your manifest containing

<action android:name="android.intent.action.CREATE_SHORTCUT" />

在你定义为接收器的活动,你是否调用方法为 ACTION_CREATE_SHORTCUT 的意图,如果是创建一些额外回来的意图(在链接我检查出setupShortcut功能提供)。
你也可以检查出源$ C ​​$ C为 Connectbot 它做到这一点pretty好。希望有所帮助。

In the activity you defined as the receiver, you check if the calling intent is a ACTION_CREATE_SHORTCUT intent, and if so create a returning intent with some extras (check out the setupShortcut function in the link I provided). You could also check out the source code for Connectbot which does this pretty well. Hope that helps.

这篇关于如何添加条目(指向活动),以&QUOT;主屏幕 - &GT;菜单 - &GT;添加 - &GT;快捷键和QUOT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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