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 Create a Transition

Create a Transition

The challenge editor says there are syntax errors, but I can't see any. Would appreciate another pair of eyes!

P.S., contrary to the error message, there is no Preview button for this challenge.

CodeChallenge.java
// Add your code below!
ViewGroup root = (ViewGroup) findViewById(R.id.container);

//Task 1 -- passes
Scene expandedScene = Scene.getSceneForLayout(root, R.layout.transition_scene_2, this.getContext());


//Task 2 -- fails
TransitionSet transitionSet = new TransitionSet();

ChangeBounds changeBounds = new ChangeBounds();
transitionSet.addTransition(changeBounds);

TransitionManager.go(expandedScene, transitionSet);
// gets error: Bummer! There is a compiler error.  Please click on preview to view your syntax errors!
Simon Coates
Simon Coates
28,694 Points

fyi, i sent support a screenshot of the message and imaginary button. I've seen the messages about non-existent preview buttons a few times before, so i'd assume they already know.

2 Answers

Seth Kroger
Seth Kroger
56,414 Points

I think the issue is TransitionSet isn't imported because it isn't needed with only one transition. The challenge does accept the following:

// Add your code below!
ViewGroup root = (ViewGroup) findViewById(R.id.container);

//Task 1 -- passes
Scene expandedScene = Scene.getSceneForLayout(root, R.layout.transition_scene_2, this.getContext());

//Task 2 -- passes
TransitionManager.go(expandedScene, new ChangeBounds());

Seth, thanks.

Simon Coates
Simon Coates
28,694 Points

it accepts:

// Add your code below!
ViewGroup root = (ViewGroup) findViewById(R.id.container);

//Task 1 -- passes
Scene expandedScene = Scene.getSceneForLayout(root, R.layout.transition_scene_2, this.getContext());


//Task 2 -- fails
TransitionManager tm= new TransitionManager();
tm.go(expandedScene, new Transition());

I don't know android, so i don't have a clue why it accepts this, but it gave you a syntax problem on the line

TransitionSet transitionSet = new TransitionSet();

so it was basically rejecting your approach from the get-go. So it's probably something dumb like the challenge not having the necessary imports.