First of all ... separate the update logic from your onCreate method. So, for example, you can create updateHTML() .
Then you can use Timer to periodically refresh the page:
public class YourActivity extends Activity { private Timer autoUpdate; public void onCreate(Bundle b){ super.onCreate(b);
Please note that I cancel the update task to onPause , in which case the updateHTML method runs every 40 seconds (40,000 milliseconds). Also, make sure you import these two classes: java.util.Timer and java.util.TimerTask .
Cristian
source share