Android无法显示选择器



当使用配置的选择器意图调用startActivity时,Android选择器不会显示任何可以处理意图的应用程序列表。我怀疑我的处理活动没有正确配置,但并不是意图过滤器的组合导致了它的显示。免责声明:这是一个在线课程。

static private final String URL = "http://www.google.com";
Intent baseIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(URL));
Intent chooserIntent = Intent.createChooser(baseIntent, CHOOSER_TEXT);
startActivity(chooserIntent);

处理活动:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="http" />
</intent-filter>

选择器从不显示。安卓系统转而推出chrome。这种情况既发生在模拟器上,也发生在我的触摸板上。

编辑您的意向过滤器如下:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="http" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

最新更新