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 8679413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:57:58+00:00 2026-06-12T20:57:58+00:00

I am using a list view in which i have button for downloading. I

  • 0

I am using a list view in which i have button for downloading.

I Want to rotate button on click event until some background downloading process working.

The rotation works fine but some delay when one cycle completes.

The main problem is that when button is animating and user scroll the list some other buttons in different rows also starts animation.

I have an array of boolean type to keep button state isDownloading[]. so i get the button on that position and start animation but it creating problem

Code to get button fro animation :

else if (isDownloading[position] == true)
        {
                                    holder.downloadListBtn.setBackgroundResource(R.drawable.downloading);
                                    LinearLayout layout = (LinearLayout) holder.downloadListBtn.getParent();
                                    Button button = (Button) layout.getChildAt(0);
                                    ButtonAnimate(button);
        }

Code to animate button :

public void ButtonAnimate(Button b)
        {
            RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
            animation.setDuration(4500);
            animation.setRepeatCount(100);
            b.startAnimation(animation);
        }
  • 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-12T20:57:59+00:00Added an answer on June 12, 2026 at 8:57 pm

    All of button starts animating because they are having same id, when they got focus they starts animating. so, what you have to do is assign different ids or tags.

    On the basis of that id and tag, make that button rotate.

    try this code on button click

     Rotater.runRotatorAnimation(this, v.getId());
    
     public class Rotater {
    public static void runRotatorAnimation(Activity act, int viewId) {
    
        // load animation XML resource under res/anim
        Animation animation = AnimationUtils.loadAnimation(act, R.anim.rotate);
        if (animation == null) {
            return; // here, we don't care
        }
        // reset initialization state
        animation.reset();
        // find View by its id attribute in the XML
        View v = act.findViewById(viewId);
        // cancel any pending animation and start this one
        if (v != null) {
            v.clearAnimation();
            v.startAnimation(animation);
        }
    }
     }
    

    here is rotate.xml

    <set xmlns:android="http://schemas.android.com/apk/res/android"
       android:interpolator="@android:anim/linear_interpolator" >
       <rotate
        android:duration="2000"
        android:fromDegrees="0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:repeatCount="infinite"
        android:startOffset="0"
        android:toDegrees="360" >
       </rotate>
    

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

Sidebar

Related Questions

I have a footer view in the list view which contain a button Search
I have one activity A, that has one button and one list view which
here i am using an activity in which there is a list view,which I
I am currently stuck on a small problem. I have a List View which
I want a list view control (or any list like control) in which each
Inside a fragment, I have a button which I want to trigger the filling
In my application I am using a List Activity in which I have passed
I want to have a list view with each row having two buttons like
I have a ListView which is using a GridView to display a DataTable and
I have been trying to create a ListView which I can sort using drag

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.