-1

I recently make a WebView App for my website and i have a few versions of it but i like this the best. On the tutorial guy video, it all works 100% Great but on mine tho, theres tons and tons of errors that i had resoved. Now one left, the app crashes every single time i tried to start it. It will show for 2 seconds and then closed.

Here's the stack trace :

08-21 20:32:52.060 3149-3149/app.gonenjoy.com E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: app.gonenjoy.com, PID: 3149
                  java.lang.NullPointerException
                  at app.gonenjoy.com.MainActivity$MyWebviewClient.onPageFinished(MainActivity.java:160)
                  at com.android.webview.chromium.WebViewContentsClientAdapter.onPageFinished(WebViewContentsClientAdapter.java:449)
                  at com.android.org.chromium.android_webview.AwContentsClient$AwWebContentsObserver$1.run(AwContentsClient.java:73)
                  at android.os.Handler.handleCallback(Handler.java:733)
                  at android.os.Handler.dispatchMessage(Handler.java:95)
                  at android.os.Looper.loop(Looper.java:146)
                  at android.app.ActivityThread.main(ActivityThread.java:5641)
                  at java.lang.reflect.Method.invokeNative(Native Method)
                  at java.lang.reflect.Method.invoke(Method.java:515)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1288)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1104)
                  at dalvik.system.NativeStart.main(Native Method)

Any help is apriciated.

Tested on Bluestacks & Samsung galaxy young 2 Android Studio v2.3

Tobias Reich
  • 4,952
  • 3
  • 47
  • 90
PlanetCloud
  • 314
  • 2
  • 11

1 Answers1

0

I think inside of super.onPageFinished view is not same of Webview view. See the following working code.I mean it should be mWebview.

mWebView.setWebViewClient(new WebViewClient() {
   @Override  
   public void onPageFinished(WebView view, String url) {
      super.onPageFinished(mWebView, url);

   }  

   @Override
   public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {

   }
   });
   mWebView.loadUrl("your url");
slymnozdmrc
  • 390
  • 2
  • 8
  • 20
  • After overwriting my exsisting code with yours, it gave me a lot of error. Can you gave me like the a clearer view? or did you have any exsisting WebView app that has fixed back button and link is opened on the same URL but external ones open on chrome? – PlanetCloud Aug 22 '17 at 09:06
  • What kind of error did you receive? Actually I dont understand what you want? Do you want back button and click it return previous page ? Or you have webview and it has a link than click this link open in webview if it is external than open it in chrome ? – slymnozdmrc Aug 22 '17 at 10:52
  • Hello, i had fixed the problem now it is completely fine now... Now im making a flight booking app. Thanks for your help, reaally apriciated it – PlanetCloud Aug 23 '17 at 06:37
  • Thats good have nice coding :) – slymnozdmrc Aug 23 '17 at 10:48