Como reproduzir um mp3 na pasta res / raw do meu aplicativo para Android?
Eu tenho um mp3 pequeno (200kb) na pasta res / raw do meu aplicativo para Android. Estou tentando executá-lo em um emulador do Eclipse. Ele é reconhecido como um recurso no arquivo R, mas quando tento preparar / iniciar, minha atividade falha! Havia algo mais que eu precisava mudar, talvez no manifesto?
MediaPlayer mPlayer = MediaPlayer.create(FakeCallScreen.this, R.raw.mysoundfile); try { mPlayer.prepare(); mPlayer.start(); } catch (IOException e) { // handle this later }