我有此代码:
File mp3 = new File(song.getPath());
AudioFile f = AudioFileIO.read(mp3);
Tag tag = f.getTag();
tag.setField(FieldKey.TITLE,songTitle.getText().toString());
tag.setField(FieldKey.ALBUM,albumTitle.getText().toString());
tag.setField(FieldKey.ARTIST,artistTitle.getText().toString());
AudioFileIO.write(f);
更改只有在重新启动设备后才生效。您知道如何修复它吗?
将广播发送给媒体扫描仪,然后刷新内容解析器,以查看MP3文件的更改。
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(mp3)));