android Intent打开URL链接

来源:互联网 发布:淘宝app历史版本下载 编辑:程序博客网 时间:2024/06/05 07:36
一、打开链接
  1.         Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.baidu.com"));
  2.         it.setClassName("com.android.browser", "com.android.browser.BrowserActivity");
  3.         getContext().startActivity(it);
二、打开本地网页
  1. Intent intent=new Intent();
  2. intent.setAction("android.intent.action.VIEW");
  3. Uri CONTENT_URI_BROWSERS = Uri.parse("content://com.android.htmlfileprovider/sdcard/123.html");
  4. intent.setData(CONTENT_URI_BROWSERS);
  5. intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");
  6. startActivity(intent);
原创粉丝点击