I get stuck from one week to find a solution for a VM crash in a
Samsung Galaxy running a code good working with emulator. (I don't
know if this code works in any real device)
Initialy my code line crashing the VM was :
responseString = EntityUtils.toString(response.getEntity());
This code works most of time but crash arrive with a bigger answer
from the server (facebook server)
To try to locate this probleme I code the following lines without
result but with a more detailed log :
HttpEntity entity = response.getEntity();
int i = (int)entity.getContentLength();
if (i 0) {
i = 1024;
}
String charset = getContentCharSet(entity);
if (charset == null) {
charset = DEFAULT_CONTENT_CHARSET;
}
Reader reader = new InputStreamReader(new
BufferedInputStream(entity.getContent()));
CharArrayBuffer buffer = new CharArrayBuffer(i);
Log.d(LOG, executeMethodForMessage finally AFTER CharArrayBuffer);
try {
char[] tmp = new char[256];
int l;
while((l = reader.read(tmp)) != -1) {
buffer.append(tmp, 0, l);
Log.d(LOG, executeMethodForMessage buffer length : +
buffer.length());
}
} finally {
reader.close();
}
Log.d(LOG, executeMethodForMessage finally AFTER close);
Log is down here :
D/UiHandler( 1488): executeMethodForMessage mFacebook.execute AFTER
I/global ( 1488): Default buffer size used in BufferedInputStream
constructor. It would be better to be explicit if an 8k buffer is
required.
D/UiHandler( 1488): executeMethodForMessage finally AFTER CharArrayBuffer
D/UiHandler( 1488): executeMethodForMessage buffer length256
D/UiHandler( 1488): executeMethodForMessage buffer length512
D/UiHandler( 1488): executeMethodForMessage buffer length768
D/UiHandler( 1488): executeMethodForMessage buffer length1024
D/UiHandler( 1488): executeMethodForMessage buffer length1134
D/UiHandler( 1488): executeMethodForMessage buffer length1390
D/UiHandler( 1488): executeMethodForMessage buffer length1646
D/UiHandler( 1488): executeMethodForMessage buffer length1902
D/UiHandler( 1488): executeMethodForMessage buffer length2158
D/UiHandler( 1488): executeMethodForMessage buffer length2414
D/UiHandler( 1488): executeMethodForMessage buffer length2670
D/UiHandler( 1488): executeMethodForMessage buffer length2926
D/UiHandler( 1488): executeMethodForMessage buffer length3182
D/UiHandler( 1488): executeMethodForMessage buffer length3438
D/UiHandler( 1488): executeMethodForMessage buffer length3694
D/UiHandler( 1488): executeMethodForMessage buffer length3950
D/UiHandler( 1488): executeMethodForMessage buffer length4206
D/UiHandler( 1488):
D/UiHandler( 1488):
D/UiHandler( 1488): AndroidRuntime START
D/UiHandler( 1488):
D/UiHandler( 1488):
D/UiHandler( 1488): (
logcat read: Invalid argument
Any help welcome
Andre
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---