«

ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.a

时间:2024-3-2 19:48     作者:韩俊     分类: Android


Intent.ACTION_VIEW 根据用户的数据类型打开相应的Activity。这里要打开一个网页,出现ActivityNotFoundException错误。

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=www.baidu.com }

Uri uri = Uri.parse("www.baidu.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
myContext.startActivity(intent);

原因为uri网址格式不正确,应添加 http:// 。

        <p>版权声明:本文为博主原创文章,未经博主允许不得转载。</p>

标签: android

热门推荐