I have this android application which uses java-javascript bridge to pick up information from the pages browsed.
It works fine for all other links excepts for when there is a redirect.When the page is loading, i show a full screen translucent dialog box, and when loading is done i hide the dialog.
The problem is that the dialog box appears twice, one on top of the other but the the page finally redirects and loads completely, on the last dialog box still stays on the screen and freezes the whole application unless I force shut it down and re-install.
I wonder if anyone has had the same experience and any tips and tricks to work this out will be appreciated.
Thanks you!
The onPageFinished callback is only called when the page finishes loading. When a redirect happens, the webview jumps to the next address without finishing the current request.
A solution for your problem could be setting a flag that tells when the “Loading” dialog is being shown. If the flag is ON, you wouldn’t show a new one, avoiding the problem of multiple dialogs.
If wanna know more about the inner workings of the WebView, I suggest checking out the Android’s source code, specially the webkit part:
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.7_r1/android/webkit/