1, modify the permissions, add <uses-permission android:name= "Android.permission.INTERNET"/>
2, Loadurl method to indicate the agreement (such as http://,file://, etc.), I just did not write the agreement, the result WebView white screen but no error, debugging for a long time.
3. Handling jumps and returns
//JumpNewwebviewclient () {@Override Public Booleanshouldoverrideurlloading (WebView view, String URL) {//TODO auto-generated Method StubView.loadurl (URL);//Use current WebView to process jumpsreturn true;//True indicates that this event is handled here and no more broadcasts are required}}//return//onkeydown (int keycoder,keyevent event) method that overrides the activity class Public BooleanOnKeyDown (intKeyCode, KeyEvent event) { if((keycode = = Keyevent.keycode_back) &&Webview.cangoback ()) {Webview.goback ();//GoBack () indicates that the previous page of the WebView is returned return true; } return false; }
Considerations for Android WebView