I just tried following code. For some reason simple request don't work when
I'm calling loadData. But loadURL( ) is OK
private void ZZZ()
{
try
{
WebView webContent = (WebView)findViewById(R.id.viewFromPayPal);
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 10000);
HttpConnectionParams.setSoTimeout(httpParams, 10000);
HttpClient httpClient = new DefaultHttpClient(httpParams);
HttpGet httpGet = new HttpGet("http://www.yahoo.com");
HttpResponse response = httpClient.execute(httpGet);
HttpEntity entity = response.getEntity();
StringBuilder sb = new StringBuilder();
if (entity != null) {
BufferedReader reader = new BufferedReader(
new InputStreamReader(entity.getContent()));
try {
while(true)
{
String res = reader.readLine();
if(res == null || res.equals(0))
{
sb.append(res);
webContent.getSettings().setJavaScriptEnabled(true);
webContent.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webContent.getSettings().setPluginsEnabled(true);
webContent.getSettings().setSupportMultipleWindows(true);
webContent.getSettings().setSupportZoom(true);
webContent.getSettings().setBlockNetworkImage(false);
webContent.getSettings().setLoadsImagesAutomatically(true);
webContent.getSettings().setUserAgent(0);
webContent.getSettings().setUseWideViewPort(true);
webContent.loadData(sb.toString(), "text/html",
"utf-8"); - white view. no errors!
//webContent.loadUrl("http://www.yahoo.com"); -
IS OK
break;
}
Log.i("EVG_WEB", res);
sb.append(res);
}
} catch (IOException ex) {
throw ex;
} catch (RuntimeException ex) {
httpGet.abort();
throw ex;
} finally {
// Closing the input stream will trigger connection
release
reader.close();
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---