I’m busy with making an app for an android device. And now I’m testing with some things.
I want to change the background color limited times, lets say 5. Every time the background’s changed, I want it to change again after 2-3 seconds.
If I am using the Thread class, it loads the whole template after the Thread has finished, you can’t see the color changes, but they’re running in the “background” (I can see that in LogCat).
I hope that there is a tutorial or an example that I can use.
Thanks!
I recently learned how to do this. There is a good tutorial here:
http://www.vogella.com/articles/AndroidPerformance/article.html#handler
It’s a little tricky at first, you’re executing on the main thread, you start a sub-thread, and post back to the main thread.
I made this small activity to flash buttons on and off to make sure I know what’s going on:
public class HelloAndroidActivity extends Activity {
}