java - Android Development : File is probably compressed -
this'll first post on so please gentle. i'm developing android app , attempting read .txt file in. after many seperate hurdles overcome (this first attempt @ reading in text file) i've come across rather nasty problem of throwing error message
this file cannot opened file descriptor; compressed.
assetmgr = thiscontext.getassets(); try { descriptor = assetmgr.openfd("level1.txt"); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); }
the above piece of code attempting read in text file. however, returning null descriptor causing errors further down line.
inputstream = new filereader(descriptor.getfiledescriptor());
this line initialising inputstream parsing text file in loop i've created out of scope.
so problem how fix txt file not opening correctly , apprarently being compressed.
if have made errors in posting please let me know can correct them best possible advice!
cheers!
so problem how fix txt file not opening correctly , apprarently being compressed.
instead of calling openfd()
, call open()
, inputstream
directly, , replace filereader
inputstreamreader
(if want reader
interface).
Comments
Post a Comment