Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如果页面30秒未加载,如何停止web视图并显示重新加载消息?_Java_Android_Android Studio_Webview_Webkit - Fatal编程技术网

Java 如果页面30秒未加载,如何停止web视图并显示重新加载消息?

Java 如果页面30秒未加载,如何停止web视图并显示重新加载消息?,java,android,android-studio,webview,webkit,Java,Android,Android Studio,Webview,Webkit,我有一个web视图,我有这个代码(注:我是编程的初学者) 我已经有了webview客户端和webchrome客户端,您可以在这里查看和下载我的代码文件(cloud.mail.ru/public/2hHz/25DMkxh3U) 在顶部,您可以在主活动中看到我的代码。您可以检查如何找到此链接中是否已完全加载webview: 一旦开始加载webview,就可以启动处理程序并检查页面是否已完全加载,或者可以重新加载网页 final Handler handler = new Handler();

我有一个web视图,我有这个代码(注:我是编程的初学者)

我已经有了webview客户端和webchrome客户端,您可以在这里查看和下载我的代码文件(cloud.mail.ru/public/2hHz/25DMkxh3U)


在顶部,您可以在主活动中看到我的代码。

您可以检查如何找到此链接中是否已完全加载webview:

一旦开始加载webview,就可以启动处理程序并检查页面是否已完全加载,或者可以重新加载网页

final Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            // check if the webview is loaded completely after 30 seconds here
            
            //if the page is not loaded then call the below line to reload
            // mWebview.loadUrl("http://www.google.com");
        }
    }, 30000);

您可以通过以下链接查看webview是否已完全加载:

一旦开始加载webview,就可以启动处理程序并检查页面是否已完全加载,或者可以重新加载网页

final Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            // check if the webview is loaded completely after 30 seconds here
            
            //if the page is not loaded then call the below line to reload
            // mWebview.loadUrl("http://www.google.com");
        }
    }, 30000);

重写Webviewclient类并在onPageStarted方法中启动countdowntimer,取消onPageFinished中的计时器,在countdowntimer完成时调用您的方法。

重写Webviewclient类并在onPageStarted方法中启动countdowntimer,取消onPageFinished中的计时器,在倒计时结束时调用您的方法。

我更新了顶部的消息,但是我应该在哪里编写代码?我更新了顶部的消息,但是应该在哪里编写代码?
final Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            // check if the webview is loaded completely after 30 seconds here
            
            //if the page is not loaded then call the below line to reload
            // mWebview.loadUrl("http://www.google.com");
        }
    }, 30000);