Rotate Animation on multiple ImageViews

I'd like to assign 28 different rotation animations to 28 different views, and start them when activity starts. Animations should all have random startOffset and Duration. I've tried with this code, but it seems that all the animations have the same values anyway.

RotateAnimation rotate = new RotateAnimation(0.0f, 360.0f,
        Animation.RELATIVE_TO_SELF, 0.9f, Animation.RELATIVE_TO_SELF, 0.5f);

ImageView imageView;

Random r = new Random();
int delayOffset = 0;
int rotationDuration = 200;

for (int i = 0; i < ids.length; i++) {


    imageView = (ImageView) findViewById(ids[i]);

    delayOffset = r.nextInt(500 - 0);
    rotationDuration = r.nextInt(10000 - 200) + 200;



What am I doing wrong ?


you are using the exact same instance of the animation , so all of the views are starting it with the most updated value .

you should create a totally new animation for each of the views.

Need Your Help

Log Parsing with Regex

regex apache parsing logging

Hi Im trying to parse a request of Apache Log with regex using python and assign it to separate variables.

Using Bootstrap 3 to style/layout user summary box

css3 twitter-bootstrap-3

I'm trying to accomplish a (fairly) simple layout with TB3 and am having some difficulty.