下載此jar文件MyID3_for_android並將其添加到項目的構建路徑。這裏是你如何通過改變蓋
File src = new File("filepath");
MusicMetadataSet src_set = new MyID3().read(src);
File img = (new File("imagePath"));
Vector<ImageData> fileList = new Vector<ImageData>();
ImageData data = new ImageData(readFile(img), "", "", 3);
fileList.add(data);
MusicMetadata metadata = (MusicMetadata) src_set.getSimplified();
metadata.setPictureList(fileList);
File dst = new File("destinationPath");
new MyID3().write(src, dst, src_set, metadata);
你還會在Jakarta Regex jar
READFILE需要一個示例代碼只是一個函數來獲取的byte []從文件
public static byte[] readFile (File file) throws IOException {
// Open file
RandomAccessFile f = new RandomAccessFile(file, "r");
try {
// Get and check length
long longlength = f.length();
int length = (int) longlength;
if (length != longlength) throw new IOException("File size >= 2 GB");
// Read file and return data
byte[] data = new byte[length];
f.readFully(data);
return data;
}
finally {
f.close();
}
}
明白了從stackoverflow,不知道從誰:)
封面藝術是嵌入在這些MP3文件?如果是這樣,那麼我認爲音樂/媒體播放器應用程序將能夠自行爲您排序。如果封面沒有嵌入,您必須:1)從某處獲取封面圖像文件,2)[將其嵌入到您的MP3文件中](http://www.richardfarrar.com/embedding-album-art-in-的mp3文件/)。 – tiguchi 2012-07-16 18:22:42