Android利用Intent如何打开网页

来源:互联网 发布:编程的希望纪录片 编辑:程序博客网 时间:2024/05/16 12:06
一、打开链接

 Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.imiyoo.com"));

 it.setClassName("com.android.browser", "com.android.browser.BrowserActivity");

 getContext().startActivity(it);

二、打开本地网页

 Intent intent=new Intent();

 intent.setAction("android.intent.action.VIEW");

 Uri CONTENT_URI_BROWSERS = Uri.parse("content://com.android.htmlfileprovider/sdcard/123.html");

 intent.setData(CONTENT_URI_BROWSERS);

 intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");

 startActivity(intent);

原创粉丝点击