Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Animations and Transitions The Transitions Framework Transitioning Back and Forth

Animations and Transitions part 2

I don't understand how to setup the transitions, I've tried. @stevehunter

MainActivity.java
public class MainActivity extends Activity {

    protected TransitionManager mTransitionManager;
    protected Scene mScene1;
    protected Scene mScene2;
    protected Scene mCurrentScene;
    protected TransitionSet mForwardSet;
    protected TransitionSet mBackwardSet;

    // Some code omitted for brevity

    public void onButtonClicked(View view) {
        if (mCurrentScene == mScene2) {
            mCurrentScene = mScene1;
        }
        else {
            mCurrentScene = mScene2;
        }

    }

    protected void setupTransitions() {
        // These methods are setting up scenes and transitions sets like in the video
        initScenes();
        initSets(); 

       TransitionManager transition = new TransitionManager(); // Start here!
       TransitionSet mForwardSet = new TransitionSet();    
       void setTransition(Scene Scene1, Scene Scene2, TransitionSet transition);

       TransitionSet mBackwardSet = new TransitionSet();
       void setTransition(Scene Scene2, Scene Scene1, TransitionSet transition);
    }
}

2 Answers

The tag didn't work on this for some reason but I assume you've figured this one out as your later post is about the next step. Let me know if you need anything on this post and I'll get back to you.

Steve.

Hey Steve, I later figured it out thanks.

:+1: :+1: :+1: :+1: