how to set path in FileInputStream in android from raw folder
<p>i have to specify the path for a mp3 song from raw folder in FileInputStream. actually i have this code(calculating BPM) in java and converting into android. </p>

<pre><code>package beatit;

import java.io.FileInputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javazoom.jl.player.Player;

/**
 * @author Peter Backx
 */
public class Main {

static Logger log = Logger.getLogger("BeatIt");
/**
 * @param args the command line arguments
 */
public static void main(String[] args) throws Exception {
    BPM2SampleProcessor processor = new BPM2SampleProcessor();
    processor.setSampleSize(1024);
    EnergyOutputAudioDevice output = new EnergyOutputAudioDevice(processor);
    output.setAverageLength(1024);

    Player player = new Player(new FileInputStream(args[0]), output); // here i give mp3 from raw instead of arg[0].

    player.play();
    log.log(Level.INFO, "calculated BPM: " + processor.getBPM());
}
</code></pre>

<p>}</p>

<p>i tried the follows:</p>

<pre><code>Player player = new Player(new FileInputStream(R.raw.mh), output); 
</code></pre>

<p>and instead of Player i use this</p>

<pre><code>MediaPlayer mPlayer = MediaPlayer.create(this, R.raw.mh);   
</code></pre>

<p>but i got error my log cat file is</p>

<pre><code>05-02 17:04:35.180: ERROR/AndroidRuntime(278): Caused by: java.lang.IndexOutOfBoundsException
05-02 17:04:35.180: ERROR/AndroidRuntime(278):     at java.util.LinkedList.get(LinkedList.java:459)
05-02 17:04:35.180: ERROR/AndroidRuntime(278):     at beatit.beatit.BPM2SampleProcessor.getBPM(BPM2SampleProcessor.java:69)
05-02 17:04:35.180: ERROR/AndroidRuntime(278):     at beatit.beatit.Main.onCreate(Main.java:44)
05-02 17:04:35.180: ERROR/AndroidRuntime(278):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-02 17:04:35.180: ERROR/AndroidRuntime(278):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-02 17:04:35.180: ERROR/AndroidRuntime(278):     ... 11 more
</code></pre>
