Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Animations and Transitions Animations Basics Property Animation

Eliseo Ramirez
Eliseo Ramirez
2,181 Points

Next, use the methods to animate the scale of a view to double the image's width and height. Cant Figure out

This is the code that i tried first and how i thought it should be set up

imageView.animate(); private void animate() { imageView.setScaleX(0); imageView.setScaleY(0); imageView.animate().scaleX(2).scaleY(2).start();
}

but then i get all of these compiler errors

JavaTester.java:64: error: ';' expected imageView.animate() ^ JavaTester.java:65: error: illegal start of expression private void animate() { ^ JavaTester.java:65: error: ';' expected private void animate() { ^ JavaTester.java:65: error: ';' expected private void animate() { ^ 4 errors

after that, based off of what the compiler errors say, i changed my code to

imageView.animate(); Private Void animate(); { imageView.setScaleX(0).setScaleY(0); imageView.animate().scaleX(2).scaleY(2).start();
}

and it eliminated all but one error

JavaTester.java:65: error: ';' expected Private Void animate(); { ^ 1 error

if i add the semicolon between the void and animate it creates a whole new error

i tried several different ways of setting it up and i cant figure it out so im ready for help

here are the different variations of what i have tried:

imageView.animate(); //<--- with and without semicolon private void animate() { imageView.setScaleX(0); imageView.setScaleY(0); imageView.animate().scaleX(2).scaleY(2).start();
}

imageView.animate(); //<--- with and without semicolon private void animate() { fab.setScaleX(0); fab.setScaleY(0); imageView.animate().scaleX(2).scaleY(2).start();
} // also fab.animate().scaleX(2).scaleY(2).start(); with one above

anyone think they can help?

1 Answer