带代理设置的webView

时间:2012-11-06 08:34:01

标签: android webview 3g

我只知道:WebView.enablePlatformNotifications();它现在已经过时了。我在我的活动中添加了这段代码

    DefaultHttpClient httpClient = new DefaultHttpClient();

    HttpHost proxy = new HttpHost("X.X.X.X", portNumber); //proxy that i need 

    httpClient.getParams().setParameter(ConnRouteParams.DEFAULT_PROXY, proxy);

我添加了这段代码:

WebView testWebView = new WebView(this);
// WebView.enablePlatformNotifications();// it's obsoleted!
testWebView.loadUrl("http://www.google.com");

结果是:我的设备无法通过3g打开google.com。

如何让testWebView知道我所使用的代理?

1 个答案:

答案 0 :(得分:0)