Issue
There are a couple of audio mp3 files in res/raw
which go as prepacked audio files for the app. They all have proper names ...must contain only [a-z0-9_.]
which do not look nice when parsed inside ListView
.
I see many apps have their custom names for audio. For example, raw file name is "default1" and custom audio name is seen as "The Morning Shine".
How can I set custom name for all custom audios in res/raw
?
Solution
If these files are static and prepacked as you say, try having an xml resource file that holds custom Strings for each file.
I don't know how you are managing your List, but with a custom Adapter you can link the proper name based on the resource ID.
Other way that maybe could help you is read the Tags directly from the files, with the Class MediaMetadataRetriever.
Example:
MediaMetadataRetriever retriever=new MediaMetadataRetriever();
retriever.setDataSource(yourFilePath);
String songName=retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
You have other constants like METADATA_KEY_ARTIST, METADATA_KEY_ALBUM and so on for the other fields. See: http://developer.android.com/intl/es/reference/android/media/MediaMetadataRetriever.html
Don't forget to call retriever.release()
when you're done to free memory.
Good luck.
Answered By - Alberto
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.