当前位置:操作系统 > 安卓/Android >>

android中调用浏览器的代码

 

默认的浏览器都列出让用户选择的

Java代码 

Uri u = Uri.parse(url);  

Intent it = new Intent(Intent.ACTION_VIEW, url);   TestActivity.this.startActivity(it); 

 

Uri u = Uri.parse(url);

Intent it = new Intent(Intent.ACTION_VIEW, url);   TestActivity.this.startActivity(it);

指定浏览器的

Java代码 

Uri u = Uri.parse(url);  

it.setData(u);  

it.setAction( Intent.ACTION_VIEW);  

it.setClassName("com.android.browser","com.android.browser.BrowserActivity");  

TestActivity.this.startActivity(it); 

 

摘自hellorheaven

补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,