I am trying to read the contents of music files from my android device though i have been able to retrieve the files and play them i need to read the music files and convert them in to a byte array. Can someone please help me : Following is my code:
public void retrieve_music_files() {
music_column_index = musiccursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA);
musiccursor.moveToPosition(position);
String filename = musiccursor.getString(music_column_index);
Cursor musiccursor;
MediaPlayer mMediaPlayer;
int music_column_index;
try {
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.reset();
}
mMediaPlayer.setDataSource(filename);
mMediaPlayer.prepare();
mMediaPlayer.start();
} catch (Exception e) {
}
}