android中调用浏览器的代码

来源:互联网 发布:淘宝五金店铺 编辑:程序博客网 时间:2024/06/07 10:12
android中调用浏览器的代码
http://www.2cto.com/kf/201111/109800.html
2011-11-02 08:52:00      我来说两句        
收藏  我要投稿

 

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

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

原创粉丝点击