android - exception on on listing files inside assets folder -



android - exception on on listing files inside assets folder -

i want print,for testing content of 2 folder within assets folder.

the folder composed:

assets

foo.txt foo1.txt

but programme says me there aren't files.

assetmanager assetmanager = getassets(); string[] files = null; seek { files = assetmanager.list(""); } grab (ioexception e1) { e1.printstacktrace(); } (int = 0; < files.length; i++) { file file = new file(files[i]); seek { scanner scanner = new scanner(file); while (scanner.hasnextline()) { log.e(" ", " " + scanner.next()); } scanner.close(); } grab (filenotfoundexception e) { e.printstacktrace(); } }

logcat

10-06 19:38:16.328: w/system.err(12250): java.io.filenotfoundexception: /foo.txt: open failed: enoent (no such file or directory) 10-06 19:38:16.335: w/system.err(12250): @ libcore.io.iobridge.open(iobridge.java:416) 10-06 19:38:16.335: w/system.err(12250): @ java.io.fileinputstream.<init>(fileinputstream.java:78) 10-06 19:38:16.343: w/system.err(12250): caused by: libcore.io.errnoexception: open failed: enoent (no such file or directory) 10-06 19:38:16.351: w/system.err(12250): @ libcore.io.posix.open(native method) 10-06 19:38:16.351: w/system.err(12250): @ libcore.io.blockguardos.open(blockguardos.java:110)

you cannot utilize file class 'file' in assets folder. because file can handle real files on file system. instead alternative phone call assets manager open inputstream fot assets file , read stream. examples have been posted many times on forum.

android

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -