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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:32:28+00:00 2026-06-09T16:32:28+00:00

How can I trigger animations on individual views when switching activities? I.e. if the

  • 0

How can I trigger animations on individual views when switching activities?
I.e. if the user clicks a button to go to the next page, I’d like some of my views to fly off screen, and have the background crossfade into the next screen, instead of having the whole screen be animated as one piece.

Is this possible? And if so, how should it be done? (I’m using the most recent API, 4.1, and it doesn’t have to be backwards compatible)

EDIT: Currently, doing the transition-in animation is working fine by calling it in onResume(), but when I press back, the activity switches faster than any animations started in onPause() so that makes me think there’s a better way/place to do 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-09T16:32:29+00:00Added an answer on June 9, 2026 at 4:32 pm

    Overriding onResume() works fine, but onPause/onStop don’t wait for
    the animation to complete before moving to the next screen.

    What ever starts the event ex. button click would need to start the animations before start activity is called.

    button.setOnClickListener(new ViewOnClickListener() {
    
        @Override
        void onClick(... {
    
            // start animations
            // wait till they are finished
            // start activity
        }
    });
    

    Since every event that starts a new activity is going to have animation code I would also recommend moving it into some sort of helper class to avoid having duplicate code all over the place. ex.

    button1.setOnClickListener(new ViewOnClickListener() {
    
        @Override
        void onClick(... {
    
            helper.AnimateViews(/* probably pass activity or context */); 
    
            // start activity
        }
    });
    
    button2.setOnClickListener(new ViewOnClickListener() {
    
        @Override
        void onClick(... {
    
            helper.animateViews(/* probably pass activity or context */); 
    
            // start activity
        }
    });
    
    public class ViewAnimiationHelper {
    
        public void animateViews(Activity activity) {
    
            // find all views if not found then don't animate them
            View view1 = activity.findViewById(R.id.view1);
    
            if(view1 != null) {
    
                // animate view
            }
    
            View view2 = activity.findViewById(R.id.view1);
    
            if(view2 != null) {
    
                // animate view
            }
        }
    }
    

    This is all sudo java code but hopefully enough for you to get the idea. Good luck!

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

Sidebar

Related Questions

How can I trigger the distant element which associates with the current button? For
Like how the click() can be used to trigger a click event on an
May I know know I can trigger system to repaint nth row in JList?
Can a trigger for a table can be applied for tracking in same table?
How can I trigger a stored procedure in SQL Server 2005 based on emails
I'm wondering if I can use a trigger on a table to ignore columns
In SQL Server 2005 Integration Services, how can I automatically trigger a restoration of
How can I download files to my trigger.io app? My app shows offline data,
I can't get didAccelerate to trigger. I have the delegate implemented in my header
How can I set a delayed trigger in JavaScript to execute a function after

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.