Have an update method fetch the new data from the source and update the textview.
Use a Handler to delay the update Runnable.
And have the Runnable postDelay itself on the handler.
In your onCreate (where this.handler is a private Handler hander):
Using java Syntax Highlighting
this.handler = new Handler();
handler.postDelayed(myRunnable, 1000);
Parsed in 0.030 seconds, using
GeSHi 1.0.8.4
and a somewhere else in the class:
Using java Syntax Highlighting
Runnable updateSource = new Runnable() {
public void run() {
//get the stuff from the source
//add self to handler
handler.postDelayed(this, 1000);
}
};
Parsed in 0.030 seconds, using
GeSHi 1.0.8.4
Why use Handler? Because Handler allows you to do threading stuff inside the main thread, which allows for less memory usage and probably lower battery usage.