/* 首先指定Intent的action是Intent.ACTION_VIEW,这是android系统内置的动作,
常量值为android.intent.action.VIEW。然后通过Uri.parse()方法,将一个网址字符串解析为Uri对象,
再调用Intent的setData()方法将这个Uri对象传递出去 */ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("http://www.baidu.com")); startActivity(intent);
其中,setData()方法为接收一个Uri对象(Uri的定义在文章https://www.cnblogs.com/chengyangblog/p/15167389.html),用于指定当前Intent正在操作的数据,而这些数据通常都是以字符串的形式传入到Uri.parse()方法中解析产生。