当前位置: 动力学知识库 > 问答 > 编程问答 >

Blocking shouldOverrideUrlLoading in android webview

问题描述:

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?

分享给朋友:
您可能感兴趣的文章:
随机阅读: