1

Can any one say how can I convert mp3 file to byte array,byte array to string and vice versa in android application. The mp3 file which is stored in sqlite database or loading from media folder.

thanks in advance

1 Answers1

1

You should not store media data into the database. Use the filesystem and place the the filename with path into the database... maybe with some additional meta information like length of the music, bytesize etc.

This will have more benefit for different services. The first is, that mp3 is nice for streaming. If you use a string for storage, you had to read the hole thing into the memory rather than a part. Rethink your application if someone stores audiobooks with hundred megabytes into you app.

If you really need to this you should treat your mp3 as a binary file and convert it late to base64.

See (for example)

Community
  • 1
  • 1
Raxa
  • 372
  • 3
  • 7