我正在尝试在网页浏览中加载网页,但屏幕在页面上加载时停滞不前。它打开网站,但在加载后它应该显示内容 - 但不是我正在经历连续加载。还有时候应用程序无法启动它从logCat崩溃:
02-18 21:25:12.780: D/dalvikvm(9079): GC_CONCURRENT freed 101K, 81% free 488K/2560K, paused 0ms+0ms
02-18 21:25:12.790: D/jdwp(9079): Got wake-up signal, bailing out of select
02-18 21:25:12.790: D/dalvikvm(9079): Debugger has detached; object registry had 1 entries
02-18 21:25:13.040: D/dalvikvm(9103): Late-enabling CheckJNI
02-18 21:25:13.040: I/ActivityManager(310): Start proc com.example.testbrowser for activity com.example.testbrowser/.MainActivity: pid=9103 uid=10079 gids={3003}
02-18 21:25:13.270: D/TextLayoutCache(9103): Using debug level: 0 - Debug Enabled: 0
02-18 21:25:13.310: D/SurfaceFlinger(138): Release buffer at 0xb9888
02-18 21:25:13.320: D/libEGL(9103): loaded /system/lib/egl/libGLES_android.so
02-18 21:25:13.340: D/libEGL(9103): loaded /system/lib/egl/libEGL_adreno200.so
02-18 21:25:13.380: D/libEGL(9103): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
02-18 21:25:13.380: D/libEGL(9103): loaded /system/lib/egl/libGLESv2_adreno200.so
02-18 21:25:13.990: I/ActivityManager(310): No longer want ch.bitspin.timely (pid 8858): hidden #16
02-18 21:25:14.000: D/OpenGLRenderer(9103): Enabling debug mode 0
02-18 21:25:14.300: I/ActivityManager(310): Displayed com.example.testbrowser/.MainActivity: +1s494ms
02-18 21:25:14.320: A/libc(9103): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
02-18 21:25:14.510: D/SurfaceFlinger(138): Release buffer at 0xbd670
02-18 21:25:14.730: I/DEBUG(136): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-18 21:25:14.730: I/DEBUG(136): Build fingerprint: 'SEMC/LT18i_1254-2219/LT18i:4.0.4/4.1.B.0.587/tL1_3w:user/release-keys'
02-18 21:25:14.730: I/DEBUG(136): pid: 9103, tid: 9124 >>> com.example.testbrowser <<<
02-18 21:25:14.730: I/DEBUG(136): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
02-18 21:25:14.730: I/DEBUG(136): r0 00000000 r1 00000001 r2 00348c78 r3 00000000
我已经为清单添加了互联网权限,这是我的班级
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String url = "http://b2b.snowinstructors.eu/app/snowbook-app/";
WebView mainWebView = (WebView) findViewById(R.id.webView1);
WebSettings webSettings = mainWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mainWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
mainWebView.setWebViewClient(new MyCustomWebViewClient());
mainWebView.loadUrl(url);
}
private class MyCustomWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
}
答案 0 :(得分:0)
请勿在{{1}}的实施中致电loadUrl
。这会创建一个循环。