I found this example and i have a small question: How can I remove the on click to a timer or a delay where it displays the first image and waits a couple of seconds then moves
No need for threads. Just use a Handler with postDelayed messages...
public class HelloHandler extends Activity {
protected Handler handler = new Handler();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// blah blah blah
handler.postDelayed(new UpdateTask(),500);
}
protected class UpdateTask implements Runnable {
public void run() {
// Do stuff. This is UI thread.
handler.postDelayed(this, 500);
}
}
}
Since blocking the UI thread is fundamentally against the Android framework, what you'd probably have to do is set up a Thread and Handler to sleep on another thread in a loop and use the Handler to pass messages back to the UI Thread and change the image. I know I had a good Thread/Handler example around here somewhere...
Ah yes... have a look at the example on how to update a ProgressDialog through a Thread and Handler. It should give you some ideas.
http://developer.android.com/guide/topics/ui/dialogs.html#ProgressDialog
(see the expandable section "Example ProgressDialog with a second thread."