0

I use this for loop to change the background of ImageButton:

for(int i = 1 ; i <= right_num ; i++ ){
    int resourceId = this.getResources().getIdentifier("c"+left_num+"_r"+i, "id", this.getPackageName());
    ImageButton imageButton = (ImageButton) findViewById(resourceId);
    imageButton.setBackgroundResource(R.drawable.red_circle);
    sound();
}

I've tried Thread sleep, AnimationDrawable, Timer and TimerTask.

But it does not solve my problem.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Mlook
  • 73
  • 2
  • 9
  • Using an appropriate timer *will* solve the problem - but as you've only shown the version which blocks the UI thread until it's finished, we can't tell what was wrong with your timer attempt. (Don't forget you'll need to execute the code on the UI thread...) See http://stackoverflow.com/questions/6242268 for example. – Jon Skeet Dec 29 '13 at 08:46
  • Can you post an [SSCCE](http://sscce.org/) of your problem? The rest of your code would be awesome as well. – takendarkk Dec 29 '13 at 15:32
  • please complete your answer. – Mlook Dec 29 '13 at 17:04

0 Answers0