当前位置: 代码迷 >> Android >> Android浏览器怎么打开网页
  详细解决方案

Android浏览器怎么打开网页

热度:15   发布时间:2016-05-01 16:29:23.0
Android浏览器如何打开网页

一、打开链接

  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);
  相关解决方案