Changing button background dynamically in thread in Android
<p>I'm developing my first app for Android and its supposed to be a game. Everything is fine but there's one thing I just can't wrap my head around.</p>

<p>In my game's "main" activity (not the first activity which starts when the app starts) I want to have a method which starts a thread which changes a buttons background color/image (go with color because I haven't made any images just yet) for one second then turns it back. I wan't the method to also have an integer parameter which makes it perform this n times. I want to be able to call like <code>changeButtons(5);</code> and it turns button x background blue for 1 second then waits 1 second five times.</p>

<p>So practically I'm trying to make a "main" thread which runs during the game and inside that thread I'm going to run this method whenever certain conditions are true (a thread which calls a thread).</p>

<p>So I have 2 questions. The first one is "Is this possible? " and If so can someone show me how to do it (not all of it of course but help me get started at least)?  Especially I want to know if I can change a buttons background color in a thread and if so can someone show me how to write/get me started that thread? </p>

<p>The second question is a follow-up, if you can do this, can you have a like a <code>boolean b</code> which turns to true if someone presses a button and the thread can "notice" that change?  For example, if the thread is running and Obama presses button x and b turns "true" in the method <code>OnClick(View v)</code> can I, inside my main thead have an <code>if(b == true){Obama.moon();}</code> and Obama will moon? </p>
