如何创建导致非启动器活动的快捷方式?
我想在 Android 应用程序中创建一个快捷方式,它会导致另一个不是应用程序启动器的活动。
I want to create a shortcut in an android app, it lead to another activity which is not launcher of the app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要创建快捷方式本身,您需要一个特制的活动,该活动必须:
当您长按桌面并选择“快捷方式”时,就会显示此活动。
当然,快捷方式本身并没有多大用处,因此您必须将意图过滤器添加到您想要由快捷方式触发的任何活动中。意图过滤器应与您为快捷方式选择的任何意图相匹配。
我写了一个关于这个主题的小指南,它有更多细节:http://www.kind-kristiansen.no/2010/android-adding-desktop-shortcut-support-to-your-app/
如果有任何不清楚的地方请告诉我那个帖子,我会尽力清理它。
To create the shortcut itself you need a specially crafted activity which must:
This activity will then show up when you longpress your desktop and select "Shortcuts".
Of course the shortcut by itself is not much use, so you must add an intent filter to whatever activity you want to get triggered by the shortcut. The intent filter should match whatever Intent you chose for your shortcut.
I wrote a small how-to on the subject, it's got more details: http://www.kind-kristiansen.no/2010/android-adding-desktop-shortcut-support-to-your-app/
Do tell me if anything is unclear in that post, I'll try to clear it up.
我开发了以下一种方法来在 Android 主屏幕上创建快捷方式图标。只要调用它即可。
不要忘记更改您的活动名称、图标资源。快乐编码!
I have developed one method below for creating the shortcut icon on android Homescreen. Just call it.
Don't forget to change your activity name, icon resource . Happy coding !!!