Reputation: 7243
Firstly, what is the filepath for an Archos? I'm trying to get some media/audio to play, and it just won't find it...
public void onClick(View v1) {
final MediaPlayer mp = new MediaPlayer();
try {
mp.setDataSource("ARCHOS5:/Music/manowar.mp3");
mp.start();
Toast.makeText(Textbox.this, "Working", Toast.LENGTH_LONG).show();
mp.setLooping(true);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
What is wrong with that code?
Secondly: I can't get audio files in "R.raw.'filename'" to play.
It works perfectly on the emulator, but when I press the play button (a different one) on the Archos, it just crashes.
Upvotes: 0
Views: 454
Reputation: 89566
You should use openRawResource()
to access items in R.raw
. To access the SD card, check out resources like this post.
Upvotes: 0