Android 调用手机浏览器[小记],内容来自网络
// 从其他浏览器打开
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri contentUrl = Uri.parse(url);
intent.setData(contentUrl);
startActivity(Intent.createChooser(intent, "请选择浏览器"));// 防止手机中没有浏览器时报错
google官方推荐方法:点击链接内容
在startActivity调用之前进行判断,可以自定义处理更多选择,提升用户体验。
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}