java - Read mp3 tags in android application -
i use jid3lib java. when i'm working library on file stored in computer works great, when try read mp3 tags of files on emulator's sdcard got exeption.
i use following code:
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main_activity); file musicpath = environment.getexternalstoragepublicdirectory(environment.directory_music); file[] songs = musicpath.listfiles(); (int i=0; < songs.length; i++){ try { mp3file song = new mp3file(new file(songs[i].getpath())); log.d("test", song.getid3v1tag().getalbum() ); } catch (tagexception e) { log.d("test", "tag exception"); e.printstacktrace(); } catch (exception e) { log.d("test", "exception"); e.printstacktrace(); } } }
i put 2 mp3 files in sdcard, still got exception in log. can problem here?
i got following error @ logcat:
java.io.filenotfoundexception: /mnt/sdcard/music/song.mp3: open failed: eacces (permission denied)
but when i'm looking in file explorer of ddms can see files under path, , if use loop in order print file's names show correct names.
eacces (permission denied)
add read_external_storage
permission in manifest file.
and, maybe write_external_storage
also.
Comments
Post a Comment