我试图在我的应用程序的 WebView 中显示一个验证码 jpeg 图像(由 Java servlet 动态生成),但是,它有时会显示一个蓝色问号而不是验证码图像。以下是我在扩展类的shouldOverrideUrlLoading(WebView view, String url)
方法中的内容MyWebViewClient
WebViewClient
我在清单中启用了 Internet 访问,并且大约 80% 的时间都会出现问题。即有时图像确实显示正确,但非常罕见。
这里还有另一个类似的问题Image with dynamic src loading in Android browser, but not in Webview,但似乎没有明确的答案。
提前致谢
try
{
CookieSyncManager.getInstance().sync();
Log.v("Hello","CookieStore: " + httpClient.getCookieStore().toString());
HttpResponse response = httpClient.execute(httppost);
data = new BasicResponseHandler().handleResponse(response);
view.loadDataWithBaseURL(URL.toString(), data, "text/html", "UTF-8" , null);
//Log.v("Hello","Data: " + data.toString());
}
catch (ClientProtocolException e)
{
Log.v("Hello","ClientProtocolException:Overriding");
Log.v("Hello",e.toString());
e.printStackTrace();
}
catch (IOException e)
{
Log.v("Hello","IOException:Overriding");
Log.v("Hello",e.toString());
e.printStackTrace();
}