title: Android: Efficent Way of playing Sounds
body: <p>Here is my code, it's easier to show it to you and then explain:</p>
  
  <pre><code>public class Sound {
      public MediaPlayer audio;
  
      public Sound(Context context, int id) {
          audio = MediaPlayer.create(context.getApplicationContext(), id);
      }
  }
  
  public class ClassA {
      Sound sound = new Sound(getContext(), R.raw.audio);
  
      public void method() {
          //plays only once here, so its not looping, which is good
          sound.audio.start();
      }
  }
  </code></pre>
  
  <p>So what I'm trying to do here is have a class that defines a sound, and then allows me to play it, but when I load up my app on my phone, it crashes.</p>
  
  <p>I just started working with sounds today so I don't know much about. I don't know why this doesn't work, and I planned on releasing my first app today.<br>
  Your help would be much appreciated!</p>
  
  <p>Forgot to mention, the reason I'm doing this is so that my games sound doesn't crash due to creating many MediaPlayers.</p>