重新提示选择默认活动
有没有办法重新提示用户为意图选择默认活动?例如,用户选择他的默认家庭 apk,我希望他再次重新考虑他的选择。
我知道如何在 2.1 及之前版本上执行此操作,但现在有办法在 2.2 上执行此操作吗?
著名的 Home Switcher 做了类似的事情,但由于 google 团队的原因,它不再在 2.2 上运行
is there a way to reprompt the user to choose a default activity for an intent? For example, user selects his default home apk and I want him to reconsider his choice once again.
I know how to do that on 2.1 and before, but is there a way to do that now on 2.2?
Famous Home Switcher, which did similar thing, does not work on 2.2 anymore thanks to google team
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是我表示活动选择对话框的方式:
它为“HOME”应用程序启动 android 默认的 ResolverActivity。
上面的代码适用于我的 2.2 版平板电脑。
执行时,它会显示“完成操作:”对话框,列表中包含所有可能的家庭应用程序。
一种检测当前默认设置的方法,您可以询问所有首选活动。列表“filters”和“comps”包含调用 .getPreferredActivities(...) 时的数据。
filters - 包含意图过滤器数据,您可以查询它是什么类型的数据。
comps - 包含如果意图过滤器匹配则将调用的组件
这样您可以检查您的应用程序是否是用户首选的当前“主”应用程序集。
This is how I represent the Activity selection dialog:
It start the android default ResolverActivity for "HOME" Applications.
The above code is working for my 2.2 enabled tablets.
When executed, it displays the "Complete Actions with:" dialog with all possible Home applications in the list.
A way to detect which is currently set by default you could ask for all preferred activities. The lists "filters" and "comps" contain the data when calling .getPreferredActivities(...).
filters - contains the intent filter data, which you could query what type of data it is.
comps - contians the component which would be called if the intent filter matches
This way you could check if your application is the current "home" application set as preferred by the user.
除非您的应用程序是首选应用程序,否则这种情况已不再可能。然后,我认为您可以使用
clearPackagePreferredActivities()
将自己从首选中删除。换句话说,欢迎您影响自己的应用程序,但不欢迎您影响其他应用程序。
That is no longer possible, unless your app is the preferred one. Then, I think you can use
clearPackagePreferredActivities()
to remove yourself as the preferred choice.In other words, you are welcome to affect your own app, but you are not welcome to affect other apps.