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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:23:57+00:00 2026-06-06T10:23:57+00:00

How to make button not clickable while translate.animate is in progress. I tried with

  • 0

How to make button not clickable while translate.animate is in progress. I tried with button.setclickable(false) and button.setEnabled(false) both dint worked for me.

Here is my code:

b2.setOnClickListener(new OnClickListener()
{
  public void onClick(View v)
  {
    if(i%2==0)
    {
      //b2.setClickable( false );
      //            Toast toast1 = Toast.makeText(getBaseContext(), "Success", 1);
      //            toast1.show();
      if(i==0)
      {
        //b2.setOnClickListener(null);
        b2.setEnabled(false);
        //b2.setClickable(false);
        int modifierY;
        modifierY=-70;
        Animation translateAnimation=new TranslateAnimation(0, 0, 0, modifierY);
        translateAnimation.setDuration(600);
        translateAnimation.setFillEnabled(true);
        MyAnimationListener listener=new MyAnimationListener(b2, modifierY,SimpleViewPagerforAndroidActivity.this);
        translateAnimation.setAnimationListener(listener);
        // b2.setOnClickListener(null);
        Animation translateAnimation1=new TranslateAnimation(0, 0, 0,0 );
        translateAnimation1.setDuration(1000);
        translateAnimation1.setFillEnabled(true);
        MyAnimationListener listener1=new MyAnimationListener(main, 0,SimpleViewPagerforAndroidActivity.this);
        translateAnimation1.setAnimationListener(listener1);

        main.setVisibility(RelativeLayout.VISIBLE);
        /*  long time =AnimationUtils.currentAnimationTimeMillis();

        main.invalidate(); 
        b2.invalidate(); 

        translateAnimation.setStartTime(time);
        translateAnimation1.setStartTime(time);*/
        main.startAnimation(translateAnimation1);

        b2.startAnimation(translateAnimation);
        i++;
        //   b2.setOnClickListener(this);
      }
      else
      {
        //b2.setOnClickListener(null);
        b2.setEnabled(false);
        //b2.setClickable(false);
        int modifierY;
        modifierY=-70;
        Animation translateAnimation=new TranslateAnimation(0, 0, 0, modifierY);
        translateAnimation.setDuration(1000);
        translateAnimation.setFillEnabled(true);
        MyAnimationListener listener=new MyAnimationListener(b2, modifierY,SimpleViewPagerforAndroidActivity.this);
        translateAnimation.setAnimationListener(listener);

        Animation translateAnimation1=new TranslateAnimation(0, 0, 0,-150 );
        translateAnimation1.setDuration(600);
        translateAnimation1.setFillEnabled(true);
        MyAnimationListener listener1=new MyAnimationListener(main, -150,SimpleViewPagerforAndroidActivity.this);
        translateAnimation1.setAnimationListener(listener1);

        main.setVisibility(RelativeLayout.VISIBLE);
        /*   long time =AnimationUtils.currentAnimationTimeMillis();

        main.invalidate(); 
        b2.invalidate(); 

        translateAnimation.setStartTime(time);
        translateAnimation1.setStartTime(time);*/
        main.startAnimation(translateAnimation1);

        b2.startAnimation(translateAnimation);
        //   b2.setOnClickListener(this);
        i++;
      }
    }
    else 
    {
      //b2.setOnClickListener(null);
      b2.setEnabled(false);
      //b2.setClickable(false);


      Animation translateAnimation=new TranslateAnimation(0, 0, 0,150 );
      translateAnimation.setDuration(1000);
      translateAnimation.setFillEnabled(true);
      MyAnimationListener listener=new MyAnimationListener(main, 150,SimpleViewPagerforAndroidActivity.this);
      translateAnimation.setAnimationListener(listener);
      Animation translateAnimation1=new TranslateAnimation(0, 0, 0,70 );
      translateAnimation1.setDuration(600);
      translateAnimation1.setFillEnabled(true);
      MyAnimationListener listener1=new MyAnimationListener(b2, 70,SimpleViewPagerforAndroidActivity.this);
      translateAnimation1.setAnimationListener(listener1);
      /* long time =AnimationUtils.currentAnimationTimeMillis();

      main.invalidate(); 
      b2.invalidate(); 

      translateAnimation.setStartTime(time);
      translateAnimation1.setStartTime(time);
      main.startAnimation(translateAnimation1);

      b2.startAnimation(translateAnimation);*/
      b2.startAnimation(translateAnimation1);
      main.startAnimation(translateAnimation);
      i++;
      //b2.setOnClickListener(this);
    }
  }
});
  • 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-06T10:23:58+00:00Added an answer on June 6, 2026 at 10:23 am

    Check on button click whether animation is completed or not, using hasEnd property, check below code:

    if (!(animation.hasEnded()) {
      button.setClickable(false);  
    }
    else{
     button.setClickable(true);  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I make the spinner with very long text, the spinner button (not drop
I would like to make a ProgressDialog cancelable by the back button but not
Is there a way to make a listbox 's items not clickable so there's
how to make button cause validation for some controls and other not.. i have
How would you make a button in cocoa when clicked open a web page?
I want to make a button that starts my php script after I click
I want to make preview button as usual form button next to submit button(as
I wanted to make a button which is transparent until the user hovers over
I am trying to make a button for the user where he will be
I would like to make register button, but when people click on it. A

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.