today i started to write a simple android aplication. The idea is that method "click(View v)" witch is called when the button is pressed, will change background of a TextField to random color after 1 second for let's say 30 times
(long story short: 30 different background colors changing in 1 second intervals).
Here is what i have:
public void click(View v) {
for(int i = 0; i >= 30; i++){
Random rand = new Random();
final int red = rand.nextInt(255);
final int green = rand.nextInt(255);
final int blue = rand.nextInt(255);
final TextView tf = (TextView) findViewById(R.id.textView1);
// SLEEP 1 SECOND HERE ...
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
tf.setBackgroundColor(Color.rgb(red, green, blue));
}
}, 1000);
}
}
But when i press the button nothing happens. As a beginner, I would be very grateful for any advices how to fixs this.