Hi All,
I have a problem when reading data from a file "source.dat" placed in
"assets" folder of a Android project.
InputStream dis = context.getAssets().open("source.dat");//OK,
no exception
int value = 0;
byte buffer[] = new byte[256];//
int byteCount = 0;
value = dis.read();//Problem: the first read always returns -1
do {
buffer[byteCount++] = (byte) value;
value = dis.read();
} while (value != '\0' && value != -1 && byteCount < 256);
The file is about 2M. I try to debug and there are some excerpts from
"Expression View" of Eclipse
"dis.available()"= 2186042 // that means the file handle is correct,
this value is around the file size (2186342)
"dis.skip(50)"= 50 //skip method works well
"dis.skip(100)"= 100 //skip method works well
"dis.read()"= -1 //PROBLEM
I try an alternative in Windows/Java1.5. It works fine, but in
Android/Simulator.
Thanks for your helps.
Bao Le Duc
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---