机器人的WebView超时 [英] Android WebView TimeOut

查看:109
本文介绍了机器人的WebView超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来设置的W​​ebView的超时值? 我想要的WebView被timeouted如果URL是太慢了回应。

Is there a way to set the timeout value in WebView? I want the WebView to be timeouted if the url is too slow to response.

推荐答案

您可以做到这一点通过设置一个计时器,检查当前页面的进度通过调用<一href="http://developer.android.com/reference/android/webkit/WebView.html#getProgress%28%29">getProgress()而如果它小于经过一段指定时间一些阈值,则可以关闭当前页面的加载。

You can do it by setting up a Timer which checks for progress of current page by calling getProgress() and if it is less than some threshold after some specified time then you can dismiss the loading of the current page.

这篇关于机器人的WebView超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆