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

Android AudioPlayer volume extremly low

Hey, I am doing a little trivia game where I want to display a different sound effect when they choose a right or wrong answer. The problem is that the sound played with the MediaPlayer is extremly low, even with my device at its maximum volume.

Here is my code:

public void playSound(boolean isRight) {

    if(isRight){

        MediaPlayer mp = MediaPlayer.create(getApplicationContext(), R.raw.correct);
        mp.setVolume(VOLUME,VOLUME);
        mp.start();

    }else{

        MediaPlayer mp = MediaPlayer.create(getApplicationContext(), R.raw.wrong);
        mp.setVolume(VOLUME,VOLUME);
        mp.start();



    }


}

The value of VOLUME is 1.0f.

Any ideas?