【发布时间】:2013-03-09 02:46:21
【问题描述】:
下面的代码 startActivity(intent) 给了我一个错误
这是我的代码:
public class MyWebViewClient3 extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().equals("www.facebook.com")) {
// This is my web site, so do not override; let my WebView load the page
return false;
}
// Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);//this is where it goes wrong
return true;
}
}
【问题讨论】:
-
这是什么错误兄弟..?编译时间..?运行时异常..?
-
试过“http://”它不工作...
-
不能从 WebViewClient 调用 startActivity。
-
@ngesh:方法 startActivity(Intent) 未定义 MyWebViewClient 类型
-
@santhosh:是的,我在其他示例中尝试过这个,但它不适用于这个,我不明白为什么会这样......
标签: android url android-intent webview tabs