开发者

Clearing a web page from a view

I am trying to clear a webview from the view in my application.

I clear this by using: MyWebView.loadUrl("about:blank");

This works sometimes, but other times when I load the emulator this gives a force close error:

03-18 14:58:29.560: ERROR/AndroidRuntime(380): FATAL EXCEPTION: main
03-18 14:58:29.560: ERROR/AndroidRuntime(380): java.lang.NullPointerException
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at com.edu.WordJumbleMain$5.onClick(WordJumbleMain.java:168)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at android.view.View.performClick(View.java:2408)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at android.view.View$PerformClick.run(View.java:8816)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at android.os.Handler.handleCallback(Handler.java:587)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at android.os.Looper.loop(Looper.java:123)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at android.app.ActivityThread.main(ActivityThread.java:4627)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at java.lang.reflect.Method.invokeNative(Native Method)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at java.lang.reflect.Method.invoke(Method.java:521)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at com.android.internal.os.ZygoteIni开发者_StackOverflow社区t.main(ZygoteInit.java:626)
03-18 14:58:29.560: ERROR/AndroidRuntime(380):     at dalvik.system.NativeStart.main(Native Method)

Is there any other way to clear the webview from the view.

Thanks


Raj,

Perhaps you simply want to use the clearView() method?


how to hide the "Web Page not available" text when web View fails to load the page. MyWebView.clearView() is not working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜