在android中開啟瀏覽器
android.webkit.WebView wv =
(android.webkit.WebView)this.findViewById(R.id.webview);
wv.loadUrl("http://programfeelings.blogspot.com/");
或啟動一個intent來操作它
try {
Intent i = new Intent();
ComponentName comp = new ComponentName(
"com.google.android.browser",
"com.google.android.browser.BrowserActivity");
i.setComponent(comp);
i.setAction("android.intent.action.VIEW");
i.addCategory("android.intent.category.BROWSABLE");
ContentURI uri = new ContentURI(url);
i.setData(uri);
startSubActivity(i, 2);
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
public static void invokeWebBrowser(Activity activity)
{
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.google.com"));
activity.startActivity(intent);
}
沒有留言:
張貼留言