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

  • Home
  • SEARCH
  • 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 8137313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:04:34+00:00 2026-06-06T11:04:34+00:00

I want to rotate imageview with continuously looping on android.my code rotate is working

  • 0

I want to rotate imageview with continuously looping on android.my code rotate is working perfectly with out set repeat mode.if i set repeat mode repeat animation not working but, imageview statically rotate some angle and i want loop rotate animation any one can help me with greatly appreciated!

here’s animation xml

<?xml version="1.0" encoding="utf-8"?>
<rotate
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:fromDegrees="45"
  android:toDegrees="45"
  android:pivotX="50%"
  android:pivotY="50%"
  android:duration="100"
  android:startOffset="0"
/>

here’s my java class

import android.app.Activity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class AnimationActivity extends Activity {
    /** Called when the activity is first created. */
    ImageView my_image;
    AnimationListener listener;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        listener = new AnimationListener() {
            @Override public void onAnimationStart(Animation animation) {}
            @Override public void onAnimationRepeat(Animation animation) {}
            @Override
            public void onAnimationEnd(Animation animation) {
                System.out.println("End Animation!");
                //load_animations();
            }
        };

        my_image=(ImageView)findViewById(R.id.my_img);
        load_animations();



    }
    void load_animations()
    {
        new AnimationUtils();
        Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotation);
        rotation.setRepeatCount(-1);
        rotation.setRepeatMode(2);
        rotation.setAnimationListener(listener);
        my_image.startAnimation(rotation);
    }

}

Thanks in Advance!

  • 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-06-06T11:04:35+00:00Added an answer on June 6, 2026 at 11:04 am

    finally,i got solution try below xml:

    <?xml version="1.0" encoding="utf-8"?>
    <rotate
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:fromDegrees="0"
      android:toDegrees="360"
      android:pivotX="50%"
      android:pivotY="50%"
      android:duration="2000"
      android:repeatMode="reverse"
      android:repeatCount="infinite"
      android:startOffset="0"
    />
    

    here’s my class

    import android.app.Activity;
    import android.os.Bundle;
    import android.view.animation.Animation;
    import android.view.animation.Animation.AnimationListener;
    import android.view.animation.AnimationUtils;
    import android.widget.ImageView;
    
    public class AnimationActivity extends Activity {
        /** Called when the activity is first created. */
        ImageView my_image;
        AnimationListener listener;
        @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            listener = new AnimationListener() {
                @Override public void onAnimationStart(Animation animation) {}
                @Override public void onAnimationRepeat(Animation animation) {}
                @Override
                public void onAnimationEnd(Animation animation) {
                    System.out.println("End Animation!");
                    //load_animations();
                }
            };
    
            my_image=(ImageView)findViewById(R.id.my_img);
            load_animations();
    
    
    
        }
        void load_animations()
        {
            new AnimationUtils();
            Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotation);
            rotation.setAnimationListener(listener);
            my_image.startAnimation(rotation);
        }
    
    }
    

    That’s the code is working perfectly!

    My problem was solved!

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

Sidebar

Related Questions

I want to show two animation simultaneously programatically not in XML file.It should ROTATE
I want to rotate image dynamically(Not by XML code). I am using this code
i'm still working on a piece of code, i want to rotate the image
I am working in an android application and I want to place an ImageView
I want to apply a rotate Animation to an action in my ActionBar .
in my android app, when i rotate/tilt my device, i want to rotate my
I have a wheel, I want to rotate it on its position. my code
I want rotate a element with css3 animation and transform property,which from 20 degree
I want to rotate an image using ImageView.setImageMatrix(matrix) but it simply doesn't have any
In my android project I have an image that i want to rotate it

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.