How to load URL consecutively one by one

后端 未结 6 1918
野趣味
野趣味 2021-01-06 03:13

I want to load URL one by one.I used String array to store the URL.My requirement is that if the webview loads the first url it should print the msg \"page started\" when p

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-06 03:50

    Try this one ...

    int position=0;
    
    textview.setText("page started");
    browser.loadUrl("your first url");
    browser.setWebChromeClient(new WebChromeClient()
    {
        public void onProgressChanged(WebView view, int progress) 
        {
           if(progress == 100)
           {
              textview.setText("page finished");
              if(position==0)
              {
                browser.loadUrl("your second url");
                position=1;
                textview.setText("page started");
              } 
              if(position==1)
              {
                browser.loadUrl("your third url");
                position=2;
                textview.setText("page started");
              } 
           }
        }
    });
    

    you can also display Toast Instead of TextView..

提交回复
热议问题