简体   繁体   中英

how to write tags,meta data to a file with android java(when we right click on windows>properties)

I want to add a comment to a file(video,txt,etc...). right click on a file on windows the comment should appear.

File tempf= new File (Environment.getExternalStorageDirectory().getAbsolutePath()+"/picedittemp");
tempf.setcommentOrTittle("mycomment to file");                                              

Not all files contain a comment field so there is no standard way of doing it. Each file type however will have a library which will allow you to modify its tags. An mp3 for example has the JAudioTagger library which allows you to set tags like this.

//No guarantee this will work (just an example)

 File track = new File("C:/path/to/song.mp3");

 AudioFile f = AudioFileIO.read(track);

 f.getTag().setField(FieldKey.COMMENT,"My Comment");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM