title: Game Sound effects in Android
body: <p>I am developing a simple game in Android. I want to add sound effects for each of the touch 
  events. However I have add background sound effect that runs throughout the game. But
  how can add tiny sound effect for touching any character of the game. For better understanding
  following is my class design :
  I have a main activity from where as view I'm calling my GameView class that extends 
  surfaceView. For the bacground sound I just created the sound at mainActivity and then called
  that GameView class as bellow:</p>
  
  <pre><code>public class MainActivity extends Activity {
      MediaPlayer backgroundMusic;
  
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          requestWindowFeature(Window.FEATURE_NO_TITLE);
           backgroundMusic = MediaPlayer.create(MainActivity.this, R.raw.bg);
  
  
           backgroundMusic.setLooping(true);
           backgroundMusic.setVolume(10.0f, 3.0f);
           backgroundMusic.start();
  
          setContentView(new GameView(this));
      }
  }
  </code></pre>
  
  <p>And following is my GameView class. I want to add sound effect here in this class onTouchEvent as bellow:</p>
  
  <pre><code>public class GameView extends SurfaceView {
   @Override
   public boolean onTouchEvent(MotionEvent event) {
     //checking condition I want to give different sound here.
  
    }
  }
  </code></pre>
  
  <p>I tried to do it as mainActivity (that is using MediaPlayer.creat() ), but it shows error.
  Anybody knows how to add such sound effect on the basis of my class design ?</p>