title: Android: playing audio files in /res/raw by file name
body: <p>In my application's /res/raw/ folder, I have: <code>file1.ogg file2.ogg ... fileN.ogg</code> </p>
  
  <p>In a local database, I have the references to the file names, i.e. <code>file1 file2 ... fileN</code>. </p>
  
  <p>Given one of those strings, say <code>fileM</code>, how can I play the audio contained in <code>fileM.ogg</code>? Looking for the relevant Java code here. </p>
  
  <p>Here's what I looked at so far:</p>
  
  <pre><code>String name = "plumber";
  String link = "/res/raw/" + name + ".ogg";
  
  try {
      mp.setDataSource(link); //earlier: mp = new MediaPlayer();
      mp.prepare();
      mp.start();
  } catch (Exception e) {
      Toast.makeText(PlayScreen.this, "ERROR: audio player not working.", Toast.LENGTH_LONG).show(); 
  }
  </code></pre>
  
  <p>I get the error message in the toast. Also I've tried the <code>link</code> string without "/res/raw" in it. </p>
  
  <p>Thank you. </p>