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

Adding Sounds

I am having problems when trying to follow this tutorial. When I enter the following under the animateAnswer method:

private void playSound () {

}

The void has a red underline, when I hover over the red cross on the line number it says: Multiple markers at this line

  • syntax error, insert "enum Identifier" to complete EnumHeader
  • Syntax error on token "void", @ expected

I have tried again and again, even completing all the text under it in the tutorial but I still get this error. Please help.

4 Answers

If you are simply typing:

private void myMethod(){

}

and getting an error, then you are most likely typing outside of the class. If you paste your entire code I can take a look. Either post it here, or just post a link to a http://pastebin.com.

Here is a link to pastebin, I have copied all the Java code from MainActivity.java

http://pastebin.com/LfuyYQEP

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

You are currently defining the playSound() method within the animateAnswer() method. You just need to move it outside that last curly brace that closes the animateAnswer() method. :smile:

Haha... now I see it, it looks so obvious!

Thanks