我使用WebView创建应用程序来加载一个描述DHTML网格的JSP页面。我的问题是当我们在Web视图中滚动此网格大约100行我的应用程序挂起,内存上升并显示ANR报告,但如果我们滚动20到30行它工作正常。请建议我,我们做错了什么。这是JSP错误或我的应用程序错误。
web_view = (WebView) findViewById(R.id.web_view);
WebSettings settings = web_view.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
{ WebView.setWebContentsDebuggingEnabled(true); }
}
web_view.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
}
});
web_view.loadUrl("http://192.168.x.xyz:1212/grid.jsp?");
以下是在log cat中打印的错误
08-29 11:20:56.654 2188-2193/com.honeywell.raesystems.proraeguardianviewer I/art: Do partial code cache collection, code=39KB, data=62KB
08-29 11:20:56.656 2188-2193/com.honeywell.raesystems.proraeguardianviewer I/art: After code cache collection, code=39KB, data=62KB
08-29 11:20:56.656 2188-2193/com.honeywell.raesystems.proraeguardianviewer I/art: Increasing code cache capacity to 256KB
08-29 11:21:02.078 2188-2188/com.honeywell.raesystems.proraeguardianviewer I/Choreographer: Skipped 69 frames! The application may be doing too much work on its main thread.
08-29 11:21:02.382 2188-2188/com.honeywell.raesystems.proraeguardianviewer I/chromium: [INFO:CONSOLE(93)] "Uncaught TypeError: Cannot read property 'scrollLeft' of undefined", source: http://192.168.x.xyz:1212//dhtml/dhtmlxGrid/codebase/dhtmlxgrid.js (93)