您的位置:首页 > 移动开发 > Android开发

Android 调用手机浏览器[小记]

2015-09-09 17:57 477 查看
Android 调用手机浏览器[小记],内容来自网络

[code]    // 从其他浏览器打开
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    Uri contentUrl = Uri.parse(url);
    intent.setData(contentUrl);
    startActivity(Intent.createChooser(intent, "请选择浏览器"));// 防止手机中没有浏览器时报错


google官方推荐方法:点击链接内容

在startActivity调用之前进行判断,可以自定义处理更多选择,提升用户体验。

[code]if (intent.resolveActivity(getPackageManager()) != null) {
    startActivity(intent);
   }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: