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

Quintin Marcelino
Quintin Marcelino
2,693 Points

Compiler Error creating new scene for transition animation (but no Preview button to see the error in the challenge)

This code challenge is throwing me an error, and I'm not sure why. Since there's no preview button, I can't see what exactly is throwing the error. Any idea what may be throwing the error? Thanks in advance!

CodeChallenge.java
// Add your code below!
ViewGroup root = (ViewGroup) findViewById(R.id.container);
Scene newScene = Scene.getSceneLayout(root, R.layout.transition_scene_2, view.getContext());

1 Answer

Simon Coates
Simon Coates
28,694 Points

I couldn' get a preview button either. The following code passed:

ViewGroup root = (ViewGroup) findViewById(R.id.container);
Scene newScene = Scene.getSceneForLayout(root, R.layout.transition_scene_2, this.getContext());

I feel like there's context missing in the explanation.

Quintin Marcelino
Quintin Marcelino
2,693 Points

Awesome, that definitely works. I feel like there's a bit of context missing too, but I get it now. Thanks!