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
I tried to simulate and came up with the following:
package com.mywebslider;
import android.app.Activity;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
import android.widget.Toast;
public class WebSliderActivity extends Activity {
TextView number;
WebView mWebView;
CountDownTimer mTimer;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
number = (TextView) findViewById(R.id.number);
mTimer=new CountDownTimer(15000, 1000) {
String[] myArray={"http://www.upc.nl/","http://www.google.com","http://www.quickspot.nl"};
int currentIndex=0;
public void onTick(long millisUntilFinished) {
number.setText("seconds remaining: " + millisUntilFinished / 1000);
}
//code comment start
// i think this part could be written better
// but it works!!!
public void onFinish() {
if (currentIndex
Beside the fact this works, the array loop can be done better. main.xml should read:
The output will make a 50/50 screen. One is for the WebView and the other half shows a counter in a TextView.