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 Build a Simple Android App (retired 2014) Pretty Little Things Adding Sounds

Magic Ball Problem

Eh, after an hour of trying to figure it out, I give up. Each time I punch in this string, I can a problem error from intelligence. Any idea what I'm doing wrong?

    mAllTruthsImage.setImageResource(R.drawable.ball_animation);
    AnimationDrawable ballAnimation = (AnimationDrawable) mAllTruthsImage.getDrawable();
    if (ballAnimation.isRunning()) {
        ballAnimation.stop();
    }
    ballAnimation.start();
    }

    private void animateAnswer(){
        AlphaAnimation fadeInAnimation = new AlphaAnimation(0, 1);
        fadeInAnimation.setDuration(1500);
        fadeInAnimation.setFillAfter(true);

        mAnswerLabel.setAnimation(fadeInAnimation);
    }

    private void playsound() {
        MediaPlayer player = MediaPlayer.create(this.R.raw.crystal_ball);
        player.start();
        player.setOnCompletionListener(new OnCompletion );

    }



        player.start();
        player.setOnCompletionListener(new CompletionListener)() 

        {
        }

4 Answers

I've just completed this part of the Build a Simple Android App project and from what I can see, you're methods look okay. And while I'm not quite sure what you're asking, nor can I see any code from the beginning of your activity, I did notice that the final line of code that you have is

player.setOnCompletionListener(new CompletionListener)() 

Not only should that have a semi-colon after it but (I could be wrong) it doesn't look quite right because your CompletionListener method has ')(' instead of the standard '()' to indicate no parameters.

try the below syntax and see if it still throws the error.

player.setOnCompletionListener(new CompletionListener()); 

Are you getting this problem during a code challenge?

Hi Ernest - Nope, I'm getting this error from the Android platform.

Hi Ernest - Nope, I'm getting this error from the Android platform.