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 trialjcorum
71,830 PointsCreate 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.
// 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!
2 Answers
Seth Kroger
56,413 PointsI 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());
jcorum
71,830 PointsSeth, thanks.
Simon Coates
28,694 Pointsit 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.
Simon Coates
28,694 PointsSimon Coates
28,694 Pointsfyi, 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.