Webviewclient Shouldinterceptrequest Freezes The Webview
Solution 1:
The general principle is that you shouldn't do any heavy processing inside shouldInterceptRequest
, as it is a synchronous call (albeit on another thread). Calls for all network requests are processed on the same thread so blocking for one request will cause all of the other requests to be blocked as well.
For your use case, I would consider running a small web server inside your app, which will do all the required caching and processing. Surely, you will also need to rewrite all the links inside displayed web pages in order to point back to the local server instead of the original web server, so it may be cumbersome in some situations. But as a general approach this will help greatly with off-loading heavy work and maintaining a local cache.
There are numerous simple Java web servers around, for example:
Post a Comment for "Webviewclient Shouldinterceptrequest Freezes The Webview"