【发布时间】:2012-09-26 05:53:46
【问题描述】:
我正在开发应用程序中的 webView,其中 webview 加载的内容在按下按钮时会发生变化(两个按钮 next 和 previous ,它们只是更改 webview 中的内容)。但是按3 -4次后它开始挂起,logcat上没有打印任何内容,按钮保持按下15-20秒,然后加载下一个数据。
我已经使用这些来清除 webview.db 和缓存:-
context.this.deleteDatabase("webview.db");
context.this.deleteDatabase("webviewCache.db");
webView.getSettings().setRenderPriority(RenderPriority.HIGH);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
但它仍然挂起。我怎样才能加快速度?请帮忙?
更新:
public void setWebView(String QuestionParent,String QuestionNumber)
{
WebSettings webSettings = questionWeb.getSettings();
webSettings.setDefaultFontSize(24);
questionWeb.getSettings().setRenderPriority(RenderPriority.HIGH);
questionWeb.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
questionWeb.loadDataWithBaseURL("",integralParse.htmlParse(questionCode,"mnt/sdcard/faData/"+QuestionParent+"/"+QuestionNumber),"text/html","UTF-8","");
}
我在按下按钮时使用此方法。 integralParse.htmlParse() 方法返回一个 html 文本。
【问题讨论】: