我只能检索歌曲的元数据,但经过大量搜索后,无法弄清楚如何编辑它。这是我目前的代码:
public static void editTags(String pathOfSong, Context context, ActionMode actionMode)
{
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource(pathOfSong);
String songName = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
String albumName = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
String artistName = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
String genreName = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE);
String year = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_YEAR);
String trackNumber = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER);
//mediaMetadataRetriever.set
Log.e("UniversalCAB", "songName: " + songName + "\nalbumName: " + albumName
+ "\nartistName: " + artistName + "\ngenreName: " + genreName
+ "\nYear: " + year + "\nCD Track #: " + trackNumber);
mediaMetadataRetriever.release();
actionMode.finish();
}