问题描述:

I am trying to develop a custom webview app where in only google safe browsing sites will be opened in webview.

For that I need to send url requested in webview to google first, wait for google safe browsing api response and if safe then load the url in webview.

For that I am intercepting url in shouldOverrideUrlLoading, and sending an http request from there. But since shouldOverrideUrlLoading is called on UI thread, I get networkonmainthread exception. I can send request in async task but it wont stop webview from loading the url.

Is there any way by which I can block shouldOverrideUrlLoading without getting ANR or networkonmainthread exception?

相关阅读:
Top