Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
how can i increase the rotation speed

i want to increase the rotation speed.How can I increase the rotation speed of the ImageView in this code ??anyone please help me.I need help with this code. Thanks in advance.

public class MainActivity extends Activity {
ImageView img_one;
Button btn_one;
Random r;
int angle;
boolean restart=false;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    img_one = (ImageView) findViewById(R.id.imageView_ring);
    r=new Random();
    btn_one = (Button) findViewById(R.id.btn_1);
    btn_one.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (restart){
                 angle=angle & 360;
                angle=r.nextInt()+360;
                RotateAnimation rotate=new RotateAnimation(angle,360,RotateAnimation.RELATIVE_TO_SELF,0.5f,
                        RotateAnimation.RELATIVE_TO_SELF,0.5f);
                rotate.setFillAfter(true);
                rotate.setDuration(50);
                rotate.setInterpolator(new AccelerateDecelerateInterpolator());
                img_one.startAnimation(rotate);
                restart=false;
            }else {
                angle=r.nextInt()+360;
                RotateAnimation rotate=new RotateAnimation(0,angle,RotateAnimation.RELATIVE_TO_SELF,0.5f,
                        RotateAnimation.RELATIVE_TO_SELF,0.5f);
                rotate.setFillAfter(true);
                rotate.setDuration(50);
                rotate.setInterpolator(new AccelerateDecelerateInterpolator());
                img_one.startAnimation(rotate);
                restart=true;
            }

        }
    });
}

}

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

If you want to rotate faster, you need to lower the duration of the animation. Currently you have it set to last for 50 milliseconds:

rotate.setDuration(50);

but you can set the duration to whatever you need to achieve your desired effect.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!