1

I am creating audio player. I have stored audio files in raw folder. I have created list view for that. but I just don't know how to list those audio files in listview. I will be playing one by one songs in audio player.

Thanks for the help.

Sergey K.
  • 24,894
  • 13
  • 106
  • 174
smiley
  • 11
  • 2

1 Answers1

1

To create the list view it will be better to read the meta data of the file, You can get enough details to display in the list. There are some java libraries to manipulate mp3 tags, my choice would be javamusictag

You can get more details from this existing SO question

To read the raw resource file try this

try {
    Resources res = getResources();
    InputStream inStream = res.openRawResource(R.raw.file);

    byte[] buff = new byte[inStream.available()];
    inStream.read(buff);

} catch (Exception e) {
    e.printStackTrace();            
}

but usually what the audio player program does is, read the file from the SD card. Here you can find some useful information regarding this kind of approach.

Community
  • 1
  • 1
code-jaff
  • 9,230
  • 4
  • 35
  • 56