[英]ACTION_WEB_SEARCH cannot be performed
In my application I do 在我的应用程序中
Uri webAddress = Uri.parse("http://www.nrk.no");
Intent webIntent = new Intent(Intent.ACTION_WEB_SEARCH, webAddress);
String title = "Choose an app";
Intent chooserIntent = Intent.createChooser(webIntent, title);
startActivity(chooserIntent);
But the chooser that pops open says that No apps can perform this action
. 但是弹出的选择器说
No apps can perform this action
。 What am I doing wrong? 我究竟做错了什么?
EDIT: Changing to ACTION_VIEW made it work, why? 编辑:更改为ACTION_VIEW使其起作用,为什么?
I haven't used ACTION_WEB_SEARCH
but it looks like the difference is what action it actually takes. 我没有使用
ACTION_WEB_SEARCH
但看起来区别在于它实际执行的操作。 You aren't providing a query to search for so the appropriate action would be ACTION_VIEW
. 您没有提供要搜索的查询 ,因此适当的操作将为
ACTION_VIEW
。
Take a look here in the docs . 在docs中查看一下。 You could provide a query in the
Intent.EXTRAS
and see if that allows you to use ACTION_WEB_SEARCH
您可以在
Intent.EXTRAS
提供查询,看看是否可以使用ACTION_WEB_SEARCH
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.