admin管理员组文章数量:1130349
2014.01.17
前几天遇到一个需求:在SB Notes项目中需要点击一个Button调用默认的浏览器打开指定的url。
我认为需要注意的几点:
1、有无网络的情况
2、对于pop up出来的Window各种分辨率下的布局
3、倘若设备上未安装浏览器
尝试方法一:
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
Uri content_url = Uri.parse("https://saddleback.v2s.mobi/");
intent.setData(content_url);
intent.setClassName("com.android.browser","com.android.browser.BrowserActivity");
startActivity(intent);
在Kindle Fire中调试失败。
尝试方法二:
final Uri uri = Uri.parse("https://saddleback.v2s.mobi/");
final Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
现有所有设备都调试成功。
thanks
jack.lee
转载于:https://wwwblogs/jackxlee/p/3523612.html
2014.01.17
前几天遇到一个需求:在SB Notes项目中需要点击一个Button调用默认的浏览器打开指定的url。
我认为需要注意的几点:
1、有无网络的情况
2、对于pop up出来的Window各种分辨率下的布局
3、倘若设备上未安装浏览器
尝试方法一:
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
Uri content_url = Uri.parse("https://saddleback.v2s.mobi/");
intent.setData(content_url);
intent.setClassName("com.android.browser","com.android.browser.BrowserActivity");
startActivity(intent);
在Kindle Fire中调试失败。
尝试方法二:
final Uri uri = Uri.parse("https://saddleback.v2s.mobi/");
final Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
现有所有设备都调试成功。
thanks
jack.lee
转载于:https://wwwblogs/jackxlee/p/3523612.html
版权声明:本文标题:Android调用默认浏览器打开指定url 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/jiaocheng/1737923916a1521719.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论