Activity supporting ACTION_VIEW is not set as BROWSABLE 爆红

学《第一行代码》时可能会有以下报错

Activity supporting ACTION_VIEW is not set as BROWSABLE

在这里插入图片描述

此处添加一个intentChooser即可

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(Intent.createChooser(intent,"Choose Application"));
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="http"/>
</intent-filter>

猜你喜欢

转载自blog.csdn.net/weixin_52502987/article/details/127397265