title: Developing Application with audio playback dor Android
body: <p>I want to play a sound in an Android app by clicking a Button. But in the emulator the app quites immediately after starting.</p>
  
  <pre><code>public class FullscreenActivity extends Activity {
  
      private MediaPlayer mediaPlayer = MediaPlayer.create(this.getApplicationContext(), R.raw.sound_file_1);
      ......
  
      public void playsound(View view){
  
         mediaPlayer.setLooping(true);
         if(mediaPlayer.isPlaying() ){
             mediaPlayer.pause();
         }
         else{
             mediaPlayer.start();
         }
  }
  </code></pre>
  
  <p>This is the function which is called by this button in the layout-xml:</p>
  
  <pre><code>&lt;Button android:id="@+id/dummy_button"
                  style="?buttonBarButtonStyle"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:onClick = "playsound"
                  android:text="@string/dummy_button" /&gt;
  </code></pre>
  
  <p>I'm worring the file could not be found, but i don't know why.
  It is in the folder "<em>projectname</em>/src/main/res/raw/sound_file_1"
  First, the file had the ending ".mp3", but i deleted it as I thought this could help.</p>
  
  <p>In the device logcat, there is an error message, which says:</p>
  
  <pre><code>09-21 00:00:58.044    2075-2075/com.example.projectname E/Trace﹕ error opening trace file: No such file or directory (2)
  </code></pre>
  
  <p>thank you for your help!</p>