Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6337913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:20:34+00:00 2026-05-24T19:20:34+00:00

I am trying to get my animation to spin until the user clicks on

  • 0

I am trying to get my animation to spin until the user clicks on the view. I have set the animation to spin once and I want it to keep going on some kind of loop instead of using .clearAnimation so that the animation doesnt just stop half way through a cycle when clicked. The code I have come up with so obviously won’t work but I can think of how to do it!

while(keepSpinning){

    turntable = (ImageView)findViewById(R.id.deck1);     

    RotateAnimation r ; // = new RotateAnimation(ROTATE_FROM, ROTATE_TO);
    r = new RotateAnimation(ROTATE_FROM, ROTATE_TO, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    r.setDuration(5000);
    r.setRepeatCount(0); 

    turntable.startAnimation(r);
    turntable.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View arg0, MotionEvent arg1) {
            keepSpinning = false;
            return true;
        }
    });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:20:35+00:00Added an answer on May 24, 2026 at 7:20 pm

    Instead of the while(keepSpinning) loop, register an AnimationListener with the RotateAnimation. The RotateAnimation will invoke onAnimationRepeat() on your listener for each loop of the animation, and you can cancel the animation there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do some simple animation. I have a UIViewController that has two
I have a basic animation I am trying to get working at http://jsfiddle.net/5YrF2/3/ Everything
Trying to get an animation to play backwards while a button is held down,
I'm trying to get a basic flip animation transition working when I push a
trying to get some data from a plist into the MWPhotoBrowser sample app. Any
I'm trying to get the scaling animation to work with RaphaelJS, but I'm having
I was messing around with Core Animation trying to get it to work, and
I have this code, but can't get it all working. I am trying to
I'm trying to get an QML animation to Start every time it's clicked, without
I am trying to get a frame by frame animation to run on android

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.