Hi,
Be aware that the timer uses a new thread, so you need a handle to
communicate with the UI thread.
Regards,
Patrick
--
verzonden vanaf mijn Android.
Op 19 dec 2009 10:52 PM schreef "Andy Triboletti" :
I have some webimageviews inside a viewflipper, and I am setting a
timer so that I can play a slideshow of the images. The problem is
the timer function is getting called but the view is not actually
advancing. If I call the viewFlipper.showNext outside of the timer,
the image advances, but not inside the timer. I can't use
viewFlipper.startFlipping because each time it flips I want to
download a new image in the background.
Here's my some of the code:
public void playSlideshow() {
Timer updateProgressTimer = null;
updateProgressTimer = new Timer();
int delay = 5000; // delay for 5 sec.
int period = 5000; // repeat every sec.
updateProgressTimer.scheduleAtFixedRate(new TimerTask() {
public void run() {
System.out.println("done");
moveRight(viewFlipper);
}
}, delay, period);
}
}
public void moveRight(ViewFlipper vf) {
Log.v("moving right", Integer.toString(imageCounter));
Log.v("moving right child", Integer.toString(vf.getDisplayedChild
()));
vf.setInAnimation(slideLeftIn);
vf.setOutAnimation(slideLeftOut);
vf.showNext();
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en