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 trialMalcolm Mutambanengwe
4,205 Pointstransition manager
Its failing to load. Steve Hunter
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!
mTransitionManager.setTransition(mScene1, mScene2, mForwardSet);
mTransitionManager.setTransition(mScene2, mScene1, mBackwardSet);
mScene2.enter();
}
}
3 Answers
Steve Hunter
57,712 PointsHi Mal,
So in the onButtonClicked()
method, you are changing mCurrentScene
to be the reverse of what it currently is. That's good. But we now need to do something with that change. We want to transition to mCurrentScene
.
You have set up mTransitionManager
to manage this. So, call the transitionTo()
method on mTransitionManager
and pass in mCurrentScene
as the parameter. Do this after the if
statement but inside the onButtonClicked
method.
mTransitionManager.transitionTo(mCurrentScene);
Steve.
Malcolm Mutambanengwe
4,205 PointsHi Steve. It seems like my page is refusing to send result, its freezing. I sent message to admin. Will let you know when its been repaired.
Thanks for all the help.
Malcolm
Steve Hunter
57,712 PointsHave you refreshed the page - it sometimes gets stuck if it's been left for a while.
Malcolm Mutambanengwe
4,205 Pointsthanks. That didn't help. Have to wait on Admin