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
You can use a queue to hold the urls that are to be loaded one after another.
Queue mQueue = new LinkedList();
...
@Override
public void onCreate(Bundle savedInstanceState) {
...
mQueue.add("http://url1");
mQueue.add("http://url2");
mQueue.add("http://urln");
...
String url = mQueue.remove();
mwv.loadurl(url);
}
...
public class myweb extends WebViewClient{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
System.out.println("LOADING");
return false;
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
System.out.println("PageStarted: " + url);
}
@Override
public void onPageFinished(WebView view, String url){
System.out.println("PageFinished: " + url);
String url = null;
url = mQueue.remove();
if (url != null) {
view.loadUrl(url);
}
}
}