Android 如何调用系统默认浏览器访问

            // 调用系统默认浏览器
            // 参考:
            //  http://www.cnblogs.com/zhwl/archive/2011/11/15/2249848.html
            //  https://segmentfault.com/a/1190000003912694
            case R.id.tv_about_weibo:   // 关于微博
                // 直接打开
//                Intent intent= new Intent();
//                intent.setAction("android.intent.action.VIEW");
//                Uri weibo_url = Uri.parse(tvAboutWeibo.getText().toString());
//                intent.setData(weibo_url);
//                startActivity(intent);

                // 弹出一个选择浏览器的框,选择浏览器再进入
                Intent intent= new Intent();
                intent.setAction(Intent.ACTION_VIEW);
                Uri content_url = Uri.parse(tvAboutWeibo.getText().toString());
                intent.setData(content_url);
                startActivity(Intent.createChooser(intent,getString(R.string.about_cherry_choice_browser)));
                break;

 

posted @ 2016-10-03 19:13  zhen-Android  阅读(4003)  评论(0编辑  收藏  举报